OLD | NEW |
1 "use strict"; | 1 "use strict"; |
2 | 2 |
3 { | 3 { |
4 const {IndexedDBBackup} = require("../../lib/indexedDBBackup"); | 4 const {IndexedDBBackup} = require("../../lib/indexedDBBackup"); |
5 const info = require("info"); | 5 const info = require("info"); |
6 const {FilterStorage} = require("../../adblockpluscore/lib/filterStorage"); | 6 const {filterStorage} = require("../../adblockpluscore/lib/filterStorage"); |
7 const {Filter} = require("../../adblockpluscore/lib/filterClasses"); | 7 const {Filter} = require("../../adblockpluscore/lib/filterClasses"); |
8 const {Subscription, SpecialSubscription} = | 8 const {Subscription, SpecialSubscription} = |
9 require("../../adblockpluscore/lib/subscriptionClasses"); | 9 require("../../adblockpluscore/lib/subscriptionClasses"); |
10 | 10 |
11 let backupDelay = 100; | 11 let backupDelay = 100; |
12 let subscription = Subscription.fromObject({ | 12 let subscription = Subscription.fromObject({ |
13 title: "test", | 13 title: "test", |
14 url: "test.com", | 14 url: "test.com", |
15 homepage: "example.com", | 15 homepage: "example.com", |
16 lastSuccess: 8, | 16 lastSuccess: 8, |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 ok( | 77 ok( |
78 saveTimes[0] - start >= backupDelay, | 78 saveTimes[0] - start >= backupDelay, |
79 "first write is deferred" | 79 "first write is deferred" |
80 ); | 80 ); |
81 deepEqual( | 81 deepEqual( |
82 data.content, | 82 data.content, |
83 expectedFormat, | 83 expectedFormat, |
84 "saved data has the correct information" | 84 "saved data has the correct information" |
85 ); | 85 ); |
86 | 86 |
87 FilterStorage.removeSubscription(subscription); | 87 filterStorage.removeSubscription(subscription); |
88 FilterStorage.removeSubscription(specialSubscription); | 88 filterStorage.removeSubscription(specialSubscription); |
89 } | 89 } |
90 }, | 90 }, |
91 { | 91 { |
92 done: assert.async(), | 92 done: assert.async(), |
93 check(data) | 93 check(data) |
94 { | 94 { |
95 ok( | 95 ok( |
96 saveTimes[1] - saveTimes[0] >= backupDelay, | 96 saveTimes[1] - saveTimes[0] >= backupDelay, |
97 "next changes are saved after the write delay" | 97 "next changes are saved after the write delay" |
98 ); | 98 ); |
(...skipping 14 matching lines...) Expand all Loading... |
113 step.check(data["file:indexedDB-backup"]); | 113 step.check(data["file:indexedDB-backup"]); |
114 step.done(); | 114 step.done(); |
115 }, 0); | 115 }, 0); |
116 }; | 116 }; |
117 | 117 |
118 Object.defineProperty( | 118 Object.defineProperty( |
119 browser.storage.local, "set", | 119 browser.storage.local, "set", |
120 {value: mockSave, enumerable: true} | 120 {value: mockSave, enumerable: true} |
121 ); | 121 ); |
122 | 122 |
123 FilterStorage.addSubscription(specialSubscription); | 123 filterStorage.addSubscription(specialSubscription); |
124 FilterStorage.addSubscription(subscription); | 124 filterStorage.addSubscription(subscription); |
125 } | 125 } |
126 } | 126 } |
OLD | NEW |