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

Unified Diff: test/synchronizer.js

Issue 29934588: Issue 7094 - Encapsulate management of subscription filters (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore/
Patch Set: Pass old filters to disconnectSubscriptionFilters Created Nov. 17, 2018, 10:08 p.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 | « test/filterStorage_readwrite.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/synchronizer.js
===================================================================
--- a/test/synchronizer.js
+++ b/test/synchronizer.js
@@ -17,29 +17,27 @@
"use strict";
let {
createSandbox, setupTimerAndXMLHttp, setupRandomResult, unexpectedError, Cr,
MILLIS_IN_SECOND, MILLIS_IN_HOUR
} = require("./_common");
-let Filter = null;
let filterStorage = null;
let Prefs = null;
let Subscription = null;
exports.setUp = function(callback)
{
let globals = Object.assign({}, setupTimerAndXMLHttp.call(this),
setupRandomResult.call(this));
let sandboxedRequire = createSandbox({globals});
(
- {Filter} = sandboxedRequire("../lib/filterClasses"),
{filterStorage} = sandboxedRequire("../lib/filterStorage"),
{Prefs} = sandboxedRequire("./stub-modules/prefs"),
{Subscription} = sandboxedRequire("../lib/subscriptionClasses"),
sandboxedRequire("../lib/synchronizer")
);
callback();
};
@@ -138,26 +136,21 @@
this.runScheduledTasks(2).then(() =>
{
test.equal(subscription.downloadStatus, currentTest.downloadStatus, "Download status");
test.equal(subscription.requiredVersion, currentTest.requiredVersion, "Required version");
if (currentTest.downloadStatus == "synchronize_ok")
{
- test.deepEqual(subscription.filters, [
- Filter.fromText("foo"),
- Filter.fromText("!bar"),
- Filter.fromText("@@bas"),
- Filter.fromText("#bam")
- ], "Resulting subscription filters");
+ test.deepEqual([...subscription.filterText()], ["foo", "!bar", "@@bas", "#bam"], "Resulting subscription filters");
}
else
{
- test.deepEqual(subscription.filters, [
+ test.deepEqual([...subscription.filterText()], [
], "Resulting subscription filters");
}
}).catch(unexpectedError.bind(test)).then(() => test.done());
};
}
exports.testsDisabledUpdates = function(test)
{
@@ -302,17 +295,17 @@
this.registerHandler("/subscription", metadata =>
{
return [Cr.NS_OK, 200, "[Adblock]\n" + comment + "\nfoo\nbar"];
});
this.runScheduledTasks(2).then(() =>
{
check(test, subscription);
- test.deepEqual(subscription.filters, [Filter.fromText("foo"), Filter.fromText("bar")], "Special comment not added to filters");
+ test.deepEqual([...subscription.filterText()], ["foo", "bar"], "Special comment not added to filters");
}).catch(unexpectedError.bind(test)).then(() => test.done());
};
}
exports.testRedirects = function(test)
{
let subscription = Subscription.fromURL("http://example.com/subscription");
filterStorage.addSubscription(subscription);
« no previous file with comments | « test/filterStorage_readwrite.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld