Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: chrome/content/tests/filterClasses.js

Issue 6612283790721024: Issue 698 - Added tests for $sitekey option (Closed)
Patch Set: Created Dec. 11, 2014, 2:18 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/content/tests/matcher.js » ('j') | chrome/content/tests/regexpFilters_matching.js » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/content/tests/filterClasses.js
===================================================================
--- a/chrome/content/tests/filterClasses.js
+++ b/chrome/content/tests/filterClasses.js
@@ -38,6 +38,9 @@
result.push("contentType=" + filter.contentType);
result.push("matchCase=" + filter.matchCase);
+ let sitekeys = filter.sitekeys || [];
+ result.push("sitekeys=" + sitekeys.slice().sort().join("|"));
+
result.push("thirdParty=" + filter.thirdParty);
if (filter instanceof BlockingFilter)
{
@@ -93,6 +96,7 @@
addProperty("matchCase", "false");
addProperty("thirdParty", "null");
addProperty("domains", "");
+ addProperty("sitekeys", "");
}
if (type == "filterlist")
{
@@ -210,9 +214,9 @@
test("Filter options", function()
{
- compareFilter("bla$match-case,script,other,third-party,domain=foo.com", ["type=filterlist", "text=bla$match-case,script,other,third-party,domain=foo.com", "regexp=bla", "matchCase=true", "contentType=" + (t.SCRIPT | t.OTHER), "thirdParty=true", "domains=FOO.COM"]);
+ compareFilter("bla$match-case,script,other,third-party,domain=foo.com,sitekey=foo", ["type=filterlist", "text=bla$match-case,script,other,third-party,domain=foo.com,sitekey=foo", "regexp=bla", "matchCase=true", "contentType=" + (t.SCRIPT | t.OTHER), "thirdParty=true", "domains=FOO.COM", "sitekeys=FOO"]);
compareFilter("bla$~match-case,~script,~other,~third-party,domain=~bar.com", ["type=filterlist", "text=bla$~match-case,~script,~other,~third-party,domain=~bar.com", "regexp=bla", "contentType=" + (defaultTypes & ~(t.SCRIPT | t.OTHER) | t.DOCUMENT), "thirdParty=false", "domains=~BAR.COM"]);
- compareFilter("@@bla$match-case,script,other,third-party,domain=foo.com|bar.com|~bar.foo.com|~foo.bar.com", ["type=whitelist", "text=@@bla$match-case,script,other,third-party,domain=foo.com|bar.com|~bar.foo.com|~foo.bar.com", "regexp=bla", "matchCase=true", "contentType=" + (t.SCRIPT | t.OTHER), "thirdParty=true", "domains=BAR.COM|FOO.COM|~BAR.FOO.COM|~FOO.BAR.COM"]);
+ compareFilter("@@bla$match-case,script,other,third-party,domain=foo.com|bar.com|~bar.foo.com|~foo.bar.com,sitekey=foo|bar", ["type=whitelist", "text=@@bla$match-case,script,other,third-party,domain=foo.com|bar.com|~bar.foo.com|~foo.bar.com,sitekey=foo|bar", "regexp=bla", "matchCase=true", "contentType=" + (t.SCRIPT | t.OTHER), "thirdParty=true", "domains=BAR.COM|FOO.COM|~BAR.FOO.COM|~FOO.BAR.COM", "sitekeys=BAR|FOO"]);
// background and image should be the same for backwards compatibility
compareFilter("bla$image", ["type=filterlist", "text=bla$image", "regexp=bla", "contentType=" + (t.IMAGE)]);
« no previous file with comments | « no previous file | chrome/content/tests/matcher.js » ('j') | chrome/content/tests/regexpFilters_matching.js » ('J')

Powered by Google App Engine
This is Rietveld