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

Side by Side Diff: test/elemHide.js

Issue 29773570: Issue 6652 - Implement fast selector lookups for unknown domains (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore/
Patch Set: Created May 7, 2018, 3:38 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
« lib/elemHide.js ('K') | « lib/elemHide.js ('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 /* 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-present eyeo GmbH 3 * Copyright (C) 2006-present 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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 ); 53 );
54 } 54 }
55 55
56 exports.testGetSelectorsForDomain = function(test) 56 exports.testGetSelectorsForDomain = function(test)
57 { 57 {
58 let addFilter = filterText => ElemHide.add(Filter.fromText(filterText)); 58 let addFilter = filterText => ElemHide.add(Filter.fromText(filterText));
59 let removeFilter = filterText => ElemHide.remove(Filter.fromText(filterText)); 59 let removeFilter = filterText => ElemHide.remove(Filter.fromText(filterText));
60 60
61 testResult(test, "", []); 61 testResult(test, "", []);
62 62
63 addFilter("##star");
Manish Jethani 2018/05/07 16:10:33 These cases are important, otherwise we might brea
64 testResult(test, "", ["star"]);
65 testResult(test, "example.com", ["star"]);
66 addFilter("~special.example.com#@#star");
67 testResult(test, "", []);
68 testResult(test, "example.com", []);
69 testResult(test, "special.example.com", ["star"]);
70 testResult(test, "other.example.com", []);
71
63 addFilter("~foo.example.com,example.com##foo"); 72 addFilter("~foo.example.com,example.com##foo");
64 testResult(test, "barfoo.example.com", ["foo"]); 73 testResult(test, "barfoo.example.com", ["foo"]);
65 testResult(test, "bar.foo.example.com", []); 74 testResult(test, "bar.foo.example.com", []);
66 testResult(test, "foo.example.com", []); 75 testResult(test, "foo.example.com", []);
67 testResult(test, "example.com", ["foo"]); 76 testResult(test, "example.com", ["foo"]);
68 testResult(test, "com", []); 77 testResult(test, "com", []);
69 testResult(test, "", []); 78 testResult(test, "", []);
70 79
71 addFilter("foo.example.com##turnip"); 80 addFilter("foo.example.com##turnip");
72 testResult(test, "foo.example.com", ["turnip"]); 81 testResult(test, "foo.example.com", ["turnip"]);
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 }; 247 };
239 248
240 exports.testZeroFilterKey = function(test) 249 exports.testZeroFilterKey = function(test)
241 { 250 {
242 ElemHide.add(Filter.fromText("##test")); 251 ElemHide.add(Filter.fromText("##test"));
243 ElemHide.add(Filter.fromText("foo.com#@#test")); 252 ElemHide.add(Filter.fromText("foo.com#@#test"));
244 testResult(test, "foo.com", []); 253 testResult(test, "foo.com", []);
245 testResult(test, "bar.com", ["test"]); 254 testResult(test, "bar.com", ["test"]);
246 test.done(); 255 test.done();
247 }; 256 };
OLDNEW
« lib/elemHide.js ('K') | « lib/elemHide.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld