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

Delta Between Two Patch Sets: test/matcher.js

Issue 29375915: Issue 4878 - Start using ESLint for adblockpluscore (Closed)
Left Patch Set: Rebased. Created Feb. 28, 2017, 3:55 p.m.
Right Patch Set: Removed unused imports Created March 15, 2017, 3:11 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « test/filterStorage_readwrite.js ('k') | test/notification.js » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 /* 1 /*
2 * This file is part of Adblock Plus <https://adblockplus.org/>, 2 * This file is part of Adblock Plus <https://adblockplus.org/>,
3 * Copyright (C) 2006-2016 Eyeo GmbH 3 * Copyright (C) 2006-2016 Eyeo GmbH
4 * 4 *
5 * Adblock Plus is free software: you can redistribute it and/or modify 5 * Adblock Plus is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 3 as 6 * it under the terms of the GNU General Public License version 3 as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
8 * 8 *
9 * Adblock Plus is distributed in the hope that it will be useful, 9 * Adblock Plus is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 result = result.text; 81 result = result.text;
82 82
83 test.equal(result, expected, "combinedMatch(" + location + ", " + contentTyp e + ", " + docDomain + ", " + (thirdParty ? "third-party" : "first-party") + ", " + (sitekey || "no-sitekey") + ", " + (specificOnly ? "specificOnly" : "not-spe cificOnly") + ") with:\n" + filters.join("\n")); 83 test.equal(result, expected, "combinedMatch(" + location + ", " + contentTyp e + ", " + docDomain + ", " + (thirdParty ? "third-party" : "first-party") + ", " + (sitekey || "no-sitekey") + ", " + (specificOnly ? "specificOnly" : "not-spe cificOnly") + ") with:\n" + filters.join("\n"));
84 84
85 // Generic whitelisting rules can match for specificOnly searches, so we 85 // Generic whitelisting rules can match for specificOnly searches, so we
86 // can't easily know which rule will match for these whitelisting tests 86 // can't easily know which rule will match for these whitelisting tests
87 if (specificOnly) 87 if (specificOnly)
88 continue; 88 continue;
89 89
90 // For next run: add whitelisting filters for filters that aren't already 90 // For next run: add whitelisting filters for filters that aren't already
91 filters = filters.map((text) => text.substr(0, 2) == "@@" ? text : "@@" + te xt); 91 filters = filters.map(text => text.substr(0, 2) == "@@" ? text : "@@" + text );
92 if (expected && expected.substr(0, 2) != "@@") 92 if (expected && expected.substr(0, 2) != "@@")
93 expected = "@@" + expected; 93 expected = "@@" + expected;
94 } 94 }
95 } 95 }
96 96
97 function cacheCheck(test, matcher, location, contentType, docDomain, thirdParty, expected) 97 function cacheCheck(test, matcher, location, contentType, docDomain, thirdParty, expected)
98 { 98 {
99 let result = matcher.matchesAny(location, RegExpFilter.typeMap[contentType], d ocDomain, thirdParty); 99 let result = matcher.matchesAny(location, RegExpFilter.typeMap[contentType], d ocDomain, thirdParty);
100 if (result) 100 if (result)
101 result = result.text; 101 result = result.text;
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 cacheCheck(test, matcher, "http://fed", "IMAGE", null, true, "http://fed$third -party"); 239 cacheCheck(test, matcher, "http://fed", "IMAGE", null, true, "http://fed$third -party");
240 cacheCheck(test, matcher, "http://abc_cba", "MEDIA", null, false, "cba$~third- party,~script"); 240 cacheCheck(test, matcher, "http://abc_cba", "MEDIA", null, false, "cba$~third- party,~script");
241 cacheCheck(test, matcher, "http://abc_cba", "MEDIA", null, true, "cba$third-pa rty"); 241 cacheCheck(test, matcher, "http://abc_cba", "MEDIA", null, true, "cba$third-pa rty");
242 cacheCheck(test, matcher, "http://abc_cba", "SCRIPT", null, false, "abc$script "); 242 cacheCheck(test, matcher, "http://abc_cba", "SCRIPT", null, false, "abc$script ");
243 cacheCheck(test, matcher, "http://def?http://fed", "MEDIA", null, false, "http ://fed$~third-party,~script"); 243 cacheCheck(test, matcher, "http://def?http://fed", "MEDIA", null, false, "http ://fed$~third-party,~script");
244 cacheCheck(test, matcher, "http://def?http://fed", "MEDIA", null, true, "http: //fed$third-party"); 244 cacheCheck(test, matcher, "http://def?http://fed", "MEDIA", null, true, "http: //fed$third-party");
245 cacheCheck(test, matcher, "http://def?http://fed", "SCRIPT", null, false, "htt p://def$script"); 245 cacheCheck(test, matcher, "http://def?http://fed", "SCRIPT", null, false, "htt p://def$script");
246 246
247 test.done(); 247 test.done();
248 }; 248 };
LEFTRIGHT

Powered by Google App Engine
This is Rietveld