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

Unified Diff: test/filterListener.js

Issue 29790555: Issue 6671 - Introduce trusted subscriptions (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore/
Patch Set: Make user's own filters trusted Created May 25, 2018, 6:41 a.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « lib/subscriptionClasses.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/filterListener.js
===================================================================
--- a/test/filterListener.js
+++ b/test/filterListener.js
@@ -50,16 +50,18 @@
FilterStorage.addSubscription(Subscription.fromURL("~fl~"));
FilterStorage.addSubscription(Subscription.fromURL("~wl~"));
FilterStorage.addSubscription(Subscription.fromURL("~eh~"));
Subscription.fromURL("~fl~").defaults = ["blocking"];
Subscription.fromURL("~wl~").defaults = ["whitelist"];
Subscription.fromURL("~eh~").defaults = ["elemhide"];
+ Subscription.fromURL("~fl~").trusted = false;
+
callback();
};
function checkKnownFilters(test, text, expected)
{
let result = {};
for (let type of ["blacklist", "whitelist"])
{
@@ -105,24 +107,29 @@
result[type].sort();
}
test.deepEqual(result, expected, text);
}
exports.testAddingAndRemovingFilters = function(test)
{
+ let filter0 = Filter.fromText("filter0");
let filter1 = Filter.fromText("filter1");
let filter2 = Filter.fromText("@@filter2");
let filter3 = Filter.fromText("##filter3");
let filter4 = Filter.fromText("!filter4");
let filter5 = Filter.fromText("#@#filter5");
let filter6 = Filter.fromText("example.com#?#:-abp-properties(filter6')");
let filter7 = Filter.fromText("example.com#@#[-abp-properties='filter7']");
+ filter0.needsTrust = true;
+ FilterStorage.addFilter(filter0);
+ checkKnownFilters(test, "add filter0", {});
+
FilterStorage.addFilter(filter1);
checkKnownFilters(test, "add filter1", {blacklist: [filter1.text]});
FilterStorage.addFilter(filter2);
checkKnownFilters(test, "add @@filter2", {blacklist: [filter1.text], whitelist: [filter2.text]});
FilterStorage.addFilter(filter3);
checkKnownFilters(test, "add ##filter3", {blacklist: [filter1.text], whitelist: [filter2.text], elemhide: [filter3.text]});
FilterStorage.addFilter(filter4);
checkKnownFilters(test, "add !filter4", {blacklist: [filter1.text], whitelist: [filter2.text], elemhide: [filter3.text]});
« no previous file with comments | « lib/subscriptionClasses.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld