зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1573709 - Return an aborted watchdog for testing interrupted bookmark merges. a=testonly
Differential Revision: https://phabricator.services.mozilla.com/D41876 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
ef22bd959b
Коммит
a17323e9d8
|
@ -842,10 +842,6 @@ BufferedBookmarksEngine.prototype = {
|
|||
// aborted early.
|
||||
_defaultSort: "oldest",
|
||||
|
||||
// The time to wait before aborting a merge in `_processIncoming`. Exposed
|
||||
// for tests.
|
||||
_applyTimeout: BUFFERED_BOOKMARK_APPLY_TIMEOUT_MS,
|
||||
|
||||
async _ensureCurrentSyncID(newSyncID) {
|
||||
await super._ensureCurrentSyncID(newSyncID);
|
||||
let buf = await this._store.ensureOpenMirror();
|
||||
|
@ -885,8 +881,8 @@ BufferedBookmarksEngine.prototype = {
|
|||
await super._processIncoming(newitems);
|
||||
let buf = await this._store.ensureOpenMirror();
|
||||
|
||||
let watchdog = Async.watchdog();
|
||||
watchdog.start(this._applyTimeout);
|
||||
let watchdog = this._newWatchdog();
|
||||
watchdog.start(BUFFERED_BOOKMARK_APPLY_TIMEOUT_MS);
|
||||
|
||||
try {
|
||||
let recordsToUpload = await buf.apply({
|
||||
|
@ -1017,6 +1013,11 @@ BufferedBookmarksEngine.prototype = {
|
|||
await super.finalize();
|
||||
await this._store.finalize();
|
||||
},
|
||||
|
||||
// Returns a new watchdog. Exposed for tests.
|
||||
_newWatchdog() {
|
||||
return Async.watchdog();
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
@ -101,8 +101,13 @@ add_task(async function test_buffer_timeout() {
|
|||
await Service.recordManager.clearCache();
|
||||
await PlacesSyncUtils.bookmarks.reset();
|
||||
let engine = new BufferedBookmarksEngine(Service);
|
||||
// Abort merges immediately.
|
||||
engine._applyTimeout = 0;
|
||||
engine._newWatchdog = function() {
|
||||
// Return an already-aborted watchdog, so that we can abort merges
|
||||
// immediately.
|
||||
let watchdog = Async.watchdog();
|
||||
watchdog.controller.abort();
|
||||
return watchdog;
|
||||
};
|
||||
await engine.initialize();
|
||||
let server = await serverForFoo(engine);
|
||||
await SyncTestingInfrastructure(server);
|
||||
|
|
Загрузка…
Ссылка в новой задаче