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

Delta Between Two Patch Sets: test/filterListener.js

Issue 29897555: Issue 6940 - Use underscore prefixes lib/matcher.js (Closed)
Left Patch Set: Created Oct. 1, 2018, 5:46 a.m.
Right Patch Set: Address PS6 comment Created Oct. 24, 2018, 6:47 p.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/matcher.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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 Subscription.fromURL("~eh~").defaults = ["elemhide"]; 57 Subscription.fromURL("~eh~").defaults = ["elemhide"];
58 58
59 callback(); 59 callback();
60 }; 60 };
61 61
62 function checkKnownFilters(test, text, expected) 62 function checkKnownFilters(test, text, expected)
63 { 63 {
64 let result = {}; 64 let result = {};
65 for (let type of ["blacklist", "whitelist"]) 65 for (let type of ["blacklist", "whitelist"])
66 { 66 {
67 let matcher = defaultMatcher[type]; 67 let matcher = defaultMatcher["_" + type];
68 let filters = []; 68 let filters = [];
69 for (let [keyword, set] of matcher.filterByKeyword) 69 for (let [keyword, set] of matcher._filterByKeyword)
70 { 70 {
71 for (let filter of set) 71 for (let filter of set)
72 { 72 {
73 test.equal(matcher.findKeyword(filter), keyword, 73 test.equal(matcher.findKeyword(filter), keyword,
74 "Keyword of filter " + filter.text); 74 "Keyword of filter " + filter.text);
75 filters.push(filter.text); 75 filters.push(filter.text);
76 } 76 }
77 } 77 }
78 result[type] = filters; 78 result[type] = filters;
79 } 79 }
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after
356 checkKnownFilters(test, "add special subscription with filter2", {snippets: [f ilter1.text, filter2.text]}); 356 checkKnownFilters(test, "add special subscription with filter2", {snippets: [f ilter1.text, filter2.text]});
357 357
358 let subscription4 = Subscription.fromURL("https://easylist-downloads.adblockpl us.org/abp-filters-anti-cv.txt"); 358 let subscription4 = Subscription.fromURL("https://easylist-downloads.adblockpl us.org/abp-filters-anti-cv.txt");
359 subscription4.filters = [filter3]; 359 subscription4.filters = [filter3];
360 360
361 filterStorage.addSubscription(subscription4); 361 filterStorage.addSubscription(subscription4);
362 checkKnownFilters(test, "add ABP anti-circumvention subscription with filter3" , {snippets: [filter1.text, filter2.text, filter3.text]}); 362 checkKnownFilters(test, "add ABP anti-circumvention subscription with filter3" , {snippets: [filter1.text, filter2.text, filter3.text]});
363 363
364 test.done(); 364 test.done();
365 }; 365 };
LEFTRIGHT

Powered by Google App Engine
This is Rietveld