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

Delta Between Two Patch Sets: test/elemHide.js

Issue 29773570: Issue 6652 - Implement fast selector lookups for unknown domains (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore/
Left Patch Set: Inline doesFilterApply Created May 15, 2018, 3:37 p.m.
Right Patch Set: Avoid unnecessary Array.concat Created May 23, 2018, 12:22 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Right: Side by side diff | Download
« no previous file with change/comment | « lib/elemHide.js ('k') | no next file » | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
(no file at all)
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");
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 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 }; 240 };
232 241
233 exports.testZeroFilterKey = function(test) 242 exports.testZeroFilterKey = function(test)
234 { 243 {
235 ElemHide.add(Filter.fromText("##test")); 244 ElemHide.add(Filter.fromText("##test"));
236 ElemHide.add(Filter.fromText("foo.com#@#test")); 245 ElemHide.add(Filter.fromText("foo.com#@#test"));
237 testResult(test, "foo.com", []); 246 testResult(test, "foo.com", []);
238 testResult(test, "bar.com", ["test"]); 247 testResult(test, "bar.com", ["test"]);
239 test.done(); 248 test.done();
240 }; 249 };
LEFTRIGHT

Powered by Google App Engine
This is Rietveld