From 0c47c83e1b3b7d95681a43fbb0de0e17b2cd5b25 Mon Sep 17 00:00:00 2001 From: wolfbeast Date: Sat, 6 Oct 2018 06:57:51 +0200 Subject: Import Tycho weave client --- .../tests/unit/test_extension_storage_engine.js | 62 ---------------------- 1 file changed, 62 deletions(-) delete mode 100644 services/sync/tests/unit/test_extension_storage_engine.js (limited to 'services/sync/tests/unit/test_extension_storage_engine.js') diff --git a/services/sync/tests/unit/test_extension_storage_engine.js b/services/sync/tests/unit/test_extension_storage_engine.js deleted file mode 100644 index 1b2792703..000000000 --- a/services/sync/tests/unit/test_extension_storage_engine.js +++ /dev/null @@ -1,62 +0,0 @@ -/* Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ */ - -"use strict"; - -Cu.import("resource://services-sync/engines.js"); -Cu.import("resource://services-sync/engines/extension-storage.js"); -Cu.import("resource://services-sync/service.js"); -Cu.import("resource://services-sync/util.js"); -Cu.import("resource://testing-common/services/sync/utils.js"); -Cu.import("resource://gre/modules/ExtensionStorageSync.jsm"); - -Service.engineManager.register(ExtensionStorageEngine); -const engine = Service.engineManager.get("extension-storage"); -do_get_profile(); // so we can use FxAccounts -loadWebExtensionTestFunctions(); - -function mock(options) { - let calls = []; - let ret = function() { - calls.push(arguments); - return options.returns; - } - Object.setPrototypeOf(ret, { - __proto__: Function.prototype, - get calls() { - return calls; - } - }); - return ret; -} - -add_task(function* test_calling_sync_calls__sync() { - let oldSync = ExtensionStorageEngine.prototype._sync; - let syncMock = ExtensionStorageEngine.prototype._sync = mock({returns: true}); - try { - // I wanted to call the main sync entry point for the entire - // package, but that fails because it tries to sync ClientEngine - // first, which fails. - yield engine.sync(); - } finally { - ExtensionStorageEngine.prototype._sync = oldSync; - } - equal(syncMock.calls.length, 1); -}); - -add_task(function* test_calling_sync_calls_ext_storage_sync() { - const extension = {id: "my-extension"}; - let oldSync = ExtensionStorageSync.syncAll; - let syncMock = ExtensionStorageSync.syncAll = mock({returns: Promise.resolve()}); - try { - yield* withSyncContext(function* (context) { - // Set something so that everyone knows that we're using storage.sync - yield ExtensionStorageSync.set(extension, {"a": "b"}, context); - - yield engine._sync(); - }); - } finally { - ExtensionStorageSync.syncAll = oldSync; - } - do_check_true(syncMock.calls.length >= 1); -}); -- cgit v1.2.3