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

Side by Side Diff: chrome/content/tests/regexpFilters_matching.js

Issue 29321487: Issue 2738 - Fix tests to pass type bit mask to matching functions (Closed)
Patch Set: Updated to match adblockplus changes Created July 12, 2015, 2:05 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/content/tests/performance/matching.html ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 (function() 1 (function()
2 { 2 {
3 module("Matching of blocking filters", {setup: prepareFilterComponents, teardo wn: restoreFilterComponents}); 3 module("Matching of blocking filters", {setup: prepareFilterComponents, teardo wn: restoreFilterComponents});
4 4
5 function testMatch(text, location, contentType, docDomain, thirdParty, sitekey , expected) 5 function testMatch(text, location, contentType, docDomain, thirdParty, sitekey , expected)
6 { 6 {
7 function testMatch_internal(text, location, contentType, docDomain, thirdPar ty, sitekey, expected) 7 function testMatch_internal(text, location, contentType, docDomain, thirdPar ty, sitekey, expected)
8 { 8 {
9 let filter = Filter.fromText(text); 9 let filter = Filter.fromText(text);
10 let result = filter.matches(location, contentType, docDomain, thirdParty, sitekey); 10 let result = filter.matches(location, RegExpFilter.typeMap[contentType], d ocDomain, thirdParty, sitekey);
11 equal(!!result, expected, '"' + text + '".matches(' + location + ", " + co ntentType + ", " + docDomain + ", " + (thirdParty ? "third-party" : "first-party ") + ", " + (sitekey || "no-sitekey") + ")"); 11 equal(!!result, expected, '"' + text + '".matches(' + location + ", " + co ntentType + ", " + docDomain + ", " + (thirdParty ? "third-party" : "first-party ") + ", " + (sitekey || "no-sitekey") + ")");
12 } 12 }
13 testMatch_internal(text, location, contentType, docDomain, thirdParty, sitek ey, expected); 13 testMatch_internal(text, location, contentType, docDomain, thirdParty, sitek ey, expected);
14 if (!/^@@/.test(text)) 14 if (!/^@@/.test(text))
15 testMatch_internal("@@" + text, location, contentType, docDomain, thirdPar ty, sitekey, expected); 15 testMatch_internal("@@" + text, location, contentType, docDomain, thirdPar ty, sitekey, expected);
16 } 16 }
17 17
18 test("Basic filters", function() 18 test("Basic filters", function()
19 { 19 {
20 testMatch("abc", "http://abc/adf", "IMAGE", null, false, null, true); 20 testMatch("abc", "http://abc/adf", "IMAGE", null, false, null, true);
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after
301 testMatch("@@test$~image,document", "http://test/", "DOCUMENT", null, false, null, true); 301 testMatch("@@test$~image,document", "http://test/", "DOCUMENT", null, false, null, true);
302 testMatch("@@test$document,~image", "http://test/", "DOCUMENT", null, false, null, true); 302 testMatch("@@test$document,~image", "http://test/", "DOCUMENT", null, false, null, true);
303 testMatch("@@test$document,domain=foo.com", "http://test/", "DOCUMENT", "foo .com", false, null, true); 303 testMatch("@@test$document,domain=foo.com", "http://test/", "DOCUMENT", "foo .com", false, null, true);
304 testMatch("@@test$document,domain=foo.com", "http://test/", "DOCUMENT", "bar .com", false, null, false); 304 testMatch("@@test$document,domain=foo.com", "http://test/", "DOCUMENT", "bar .com", false, null, false);
305 testMatch("@@test$document,domain=~foo.com", "http://test/", "DOCUMENT", "fo o.com", false, null, false); 305 testMatch("@@test$document,domain=~foo.com", "http://test/", "DOCUMENT", "fo o.com", false, null, false);
306 testMatch("@@test$document,domain=~foo.com", "http://test/", "DOCUMENT", "ba r.com", false, null, true); 306 testMatch("@@test$document,domain=~foo.com", "http://test/", "DOCUMENT", "ba r.com", false, null, true);
307 testMatch("@@test$document,sitekey=foo-publickey", "http://test/", "DOCUMENT ", "foo.com", false, "foo-publickey", true); 307 testMatch("@@test$document,sitekey=foo-publickey", "http://test/", "DOCUMENT ", "foo.com", false, "foo-publickey", true);
308 testMatch("@@test$document,sitekey=foo-publickey", "http://test/", "DOCUMENT ", "foo.com", false, null, false); 308 testMatch("@@test$document,sitekey=foo-publickey", "http://test/", "DOCUMENT ", "foo.com", false, null, false);
309 }); 309 });
310 })(); 310 })();
OLDNEW
« no previous file with comments | « chrome/content/tests/performance/matching.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld