diff options
author | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
---|---|---|
committer | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
commit | 5f8de423f190bbb79a62f804151bc24824fa32d8 (patch) | |
tree | 10027f336435511475e392454359edea8e25895d /services/sync/tests/unit/test_service_startup.js | |
parent | 49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff) | |
download | UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip |
Add m-esr52 at 52.6.0
Diffstat (limited to 'services/sync/tests/unit/test_service_startup.js')
-rw-r--r-- | services/sync/tests/unit/test_service_startup.js | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/services/sync/tests/unit/test_service_startup.js b/services/sync/tests/unit/test_service_startup.js new file mode 100644 index 000000000..5148f6d13 --- /dev/null +++ b/services/sync/tests/unit/test_service_startup.js @@ -0,0 +1,49 @@ +/* Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/publicdomain/zero/1.0/ */ + +Cu.import("resource://services-common/observers.js"); +Cu.import("resource://services-sync/engines.js"); +Cu.import("resource://services-sync/util.js"); +Cu.import("resource://testing-common/services/sync/utils.js"); + +Svc.Prefs.set("registerEngines", "Tab,Bookmarks,Form,History"); +Cu.import("resource://services-sync/service.js"); + +function run_test() { + validate_all_future_pings(); + _("When imported, Service.onStartup is called"); + initTestLogging("Trace"); + + let xps = Cc["@mozilla.org/weave/service;1"] + .getService(Ci.nsISupports) + .wrappedJSObject; + do_check_false(xps.enabled); + + // Test fixtures + Service.identity.username = "johndoe"; + do_check_true(xps.enabled); + + Cu.import("resource://services-sync/service.js"); + + _("Service is enabled."); + do_check_eq(Service.enabled, true); + + _("Engines are registered."); + let engines = Service.engineManager.getAll(); + do_check_true(Utils.deepEquals(engines.map(engine => engine.name), + ['tabs', 'bookmarks', 'forms', 'history'])); + + _("Observers are notified of startup"); + do_test_pending(); + + do_check_false(Service.status.ready); + do_check_false(xps.ready); + Observers.add("weave:service:ready", function (subject, data) { + do_check_true(Service.status.ready); + do_check_true(xps.ready); + + // Clean up. + Svc.Prefs.resetBranch(""); + do_test_finished(); + }); +} |