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

Delta Between Two Patch Sets: test/filterStorage_readwrite.js

Issue 29854572: Issue 6857 - Do not serialize empty special subscriptions (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore/
Left Patch Set: Rebase Created Oct. 3, 2018, 1:26 p.m.
Right Patch Set: Use temporary Set object in unit test Created Oct. 3, 2018, 3:56 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « lib/filterStorage.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
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 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 if (withEmptySpecial) 122 if (withEmptySpecial)
123 { 123 {
124 let specialSubscription = 124 let specialSubscription =
125 SpecialSubscription.createForFilter(Filter.fromText("!foo")); 125 SpecialSubscription.createForFilter(Filter.fromText("!foo"));
126 FilterStorage.addSubscription(specialSubscription); 126 FilterStorage.addSubscription(specialSubscription);
127 127
128 FilterStorage.removeFilter(Filter.fromText("!foo"), specialSubscription); 128 FilterStorage.removeFilter(Filter.fromText("!foo"), specialSubscription);
129 129
130 test.equal(specialSubscription.filters.length, 0, 130 test.equal(specialSubscription.filters.length, 0,
131 "No filters in special subscription"); 131 "No filters in special subscription");
132 test.ok([...FilterStorage.subscriptions()].indexOf(specialSubscription) != -1, 132 test.ok(new Set(FilterStorage.subscriptions()).has(specialSubscription),
133 "Empty special subscription still in storage"); 133 "Empty special subscription still in storage");
134 } 134 }
135 135
136 return FilterStorage.saveToDisk(); 136 return FilterStorage.saveToDisk();
137 }).then(() => testData).then(expected => 137 }).then(() => testData).then(expected =>
138 { 138 {
139 test.deepEqual(canonize(IO._getFileContents(FilterStorage.sourceFile)), 139 test.deepEqual(canonize(IO._getFileContents(FilterStorage.sourceFile)),
140 canonize(expected), "Read/write result"); 140 canonize(expected), "Read/write result");
141 }).catch(unexpectedError.bind(test)).then(() => test.done()); 141 }).catch(unexpectedError.bind(test)).then(() => test.done());
142 } 142 }
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 return FilterStorage.restoreBackup(1); 263 return FilterStorage.restoreBackup(1);
264 }).then(() => 264 }).then(() =>
265 { 265 {
266 test.equal([...FilterStorage.subscriptions()][0].filters.length, 1, "Filter count after restoring backup"); 266 test.equal([...FilterStorage.subscriptions()][0].filters.length, 1, "Filter count after restoring backup");
267 return FilterStorage.loadFromDisk(); 267 return FilterStorage.loadFromDisk();
268 }).then(() => 268 }).then(() =>
269 { 269 {
270 test.equal([...FilterStorage.subscriptions()][0].filters.length, 1, "Filter count after reloading"); 270 test.equal([...FilterStorage.subscriptions()][0].filters.length, 1, "Filter count after reloading");
271 }).catch(unexpectedError.bind(test)).then(() => test.done()); 271 }).catch(unexpectedError.bind(test)).then(() => test.done());
272 }; 272 };
LEFTRIGHT

Powered by Google App Engine
This is Rietveld