michael@0: /* Any copyright is dedicated to the Public Domain. michael@0: * http://creativecommons.org/publicdomain/zero/1.0/ */ michael@0: michael@0: "use strict"; michael@0: michael@0: let gTestTab; michael@0: let gContentAPI; michael@0: let gContentWindow; michael@0: michael@0: Components.utils.import("resource:///modules/UITour.jsm"); michael@0: michael@0: function test() { michael@0: registerCleanupFunction(function() { michael@0: Services.prefs.clearUserPref("services.sync.username"); michael@0: }); michael@0: UITourTest(); michael@0: } michael@0: michael@0: let tests = [ michael@0: function test_checkSyncSetup_disabled(done) { michael@0: function callback(result) { michael@0: is(result.setup, false, "Sync shouldn't be setup by default"); michael@0: done(); michael@0: } michael@0: michael@0: gContentAPI.getConfiguration("sync", callback); michael@0: }, michael@0: michael@0: function test_checkSyncSetup_enabled(done) { michael@0: function callback(result) { michael@0: is(result.setup, true, "Sync should be setup"); michael@0: done(); michael@0: } michael@0: michael@0: Services.prefs.setCharPref("services.sync.username", "uitour@tests.mozilla.org"); michael@0: gContentAPI.getConfiguration("sync", callback); michael@0: }, michael@0: michael@0: // The showFirefoxAccounts API is sync related, so we test that here too... michael@0: function test_firefoxAccounts(done) { michael@0: // This test will load about:accounts, and we don't want that to hit the michael@0: // network. michael@0: Services.prefs.setCharPref("identity.fxaccounts.remote.signup.uri", michael@0: "https://example.com/"); michael@0: michael@0: loadUITourTestPage(function(contentWindow) { michael@0: let tabBrowser = gBrowser.selectedTab.linkedBrowser; michael@0: // This command will replace the current tab - so add a load event michael@0: // handler which will fire when that happens. michael@0: tabBrowser.addEventListener("load", function onload(evt) { michael@0: tabBrowser.removeEventListener("load", onload, true); michael@0: michael@0: ise(tabBrowser.contentDocument.location.href, michael@0: "about:accounts?action=signup", michael@0: "about:accounts should have replaced the tab"); michael@0: michael@0: // the iframe in about:accounts will still be loading, so we stop michael@0: // that before resetting the pref. michael@0: tabBrowser.contentDocument.location.href = "about:blank"; michael@0: Services.prefs.clearUserPref("identity.fxaccounts.remote.signup.uri"); michael@0: done(); michael@0: }, true); michael@0: michael@0: gContentAPI.showFirefoxAccounts(); michael@0: }); michael@0: }, michael@0: ];