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

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

Issue 6309214725079040: Issue 1409 - Fix some errors in adblockplustest (Closed)
Patch Set: Created Sept. 19, 2014, 10:35 a.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/filterStorage.js ('k') | chrome/content/tests/popupBlocker.js » ('j') | 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("Filter matcher", {setup: prepareFilterComponents, teardown: restoreFil terComponents}); 3 module("Filter matcher", {setup: prepareFilterComponents, teardown: restoreFil terComponents});
4 4
5 function compareKeywords(text, expected) 5 function compareKeywords(text, expected)
6 { 6 {
7 for (let filter of [Filter.fromText(text), Filter.fromText("@@" + text)]) 7 for (let filter of [Filter.fromText(text), Filter.fromText("@@" + text)])
8 { 8 {
9 let matcher = new Matcher(); 9 let matcher = new Matcher();
10 let result = []; 10 let result = [];
11 for (let dummy of expected) 11 for (let dummy of expected)
12 { 12 {
13 keyword = matcher.findKeyword(filter); 13 let keyword = matcher.findKeyword(filter);
14 result.push(keyword); 14 result.push(keyword);
15 if (keyword) 15 if (keyword)
16 { 16 {
17 let dummyFilter = Filter.fromText('^' + keyword + '^'); 17 let dummyFilter = Filter.fromText('^' + keyword + '^');
18 dummyFilter.filterCount = Infinity; 18 dummyFilter.filterCount = Infinity;
19 matcher.add(dummyFilter); 19 matcher.add(dummyFilter);
20 } 20 }
21 } 21 }
22 22
23 equal(result.join(", "), expected.join(", "), "Keyword candidates for " + filter.text); 23 equal(result.join(", "), expected.join(", "), "Keyword candidates for " + filter.text);
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 cacheCheck(matcher, "http://fed", "IMAGE", null, false, "http://fed$~third-p arty,~script"); 179 cacheCheck(matcher, "http://fed", "IMAGE", null, false, "http://fed$~third-p arty,~script");
180 cacheCheck(matcher, "http://fed", "IMAGE", null, true, "http://fed$third-par ty"); 180 cacheCheck(matcher, "http://fed", "IMAGE", null, true, "http://fed$third-par ty");
181 cacheCheck(matcher, "http://abc_cba", "DOCUMENT", null, false, "cba$~third-p arty,~script"); 181 cacheCheck(matcher, "http://abc_cba", "DOCUMENT", null, false, "cba$~third-p arty,~script");
182 cacheCheck(matcher, "http://abc_cba", "DOCUMENT", null, true, "cba$third-par ty"); 182 cacheCheck(matcher, "http://abc_cba", "DOCUMENT", null, true, "cba$third-par ty");
183 cacheCheck(matcher, "http://abc_cba", "SCRIPT", null, false, "abc$script"); 183 cacheCheck(matcher, "http://abc_cba", "SCRIPT", null, false, "abc$script");
184 cacheCheck(matcher, "http://def?http://fed", "DOCUMENT", null, false, "http: //fed$~third-party,~script"); 184 cacheCheck(matcher, "http://def?http://fed", "DOCUMENT", null, false, "http: //fed$~third-party,~script");
185 cacheCheck(matcher, "http://def?http://fed", "DOCUMENT", null, true, "http:/ /fed$third-party"); 185 cacheCheck(matcher, "http://def?http://fed", "DOCUMENT", null, true, "http:/ /fed$third-party");
186 cacheCheck(matcher, "http://def?http://fed", "SCRIPT", null, false, "http:// def$script"); 186 cacheCheck(matcher, "http://def?http://fed", "SCRIPT", null, false, "http:// def$script");
187 }); 187 });
188 })(); 188 })();
OLDNEW
« no previous file with comments | « chrome/content/tests/filterStorage.js ('k') | chrome/content/tests/popupBlocker.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld