Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
1 /* Any copyright is dedicated to the Public Domain.
2 * http://creativecommons.org/publicdomain/zero/1.0/ */
4 "use strict";
6 let gTestTab;
7 let gContentAPI;
8 let gContentWindow;
10 Components.utils.import("resource:///modules/UITour.jsm");
12 function test() {
13 registerCleanupFunction(function() {
14 Services.prefs.clearUserPref("services.sync.username");
15 });
16 UITourTest();
17 }
19 let tests = [
20 function test_checkSyncSetup_disabled(done) {
21 function callback(result) {
22 is(result.setup, false, "Sync shouldn't be setup by default");
23 done();
24 }
26 gContentAPI.getConfiguration("sync", callback);
27 },
29 function test_checkSyncSetup_enabled(done) {
30 function callback(result) {
31 is(result.setup, true, "Sync should be setup");
32 done();
33 }
35 Services.prefs.setCharPref("services.sync.username", "uitour@tests.mozilla.org");
36 gContentAPI.getConfiguration("sync", callback);
37 },
39 // The showFirefoxAccounts API is sync related, so we test that here too...
40 function test_firefoxAccounts(done) {
41 // This test will load about:accounts, and we don't want that to hit the
42 // network.
43 Services.prefs.setCharPref("identity.fxaccounts.remote.signup.uri",
44 "https://example.com/");
46 loadUITourTestPage(function(contentWindow) {
47 let tabBrowser = gBrowser.selectedTab.linkedBrowser;
48 // This command will replace the current tab - so add a load event
49 // handler which will fire when that happens.
50 tabBrowser.addEventListener("load", function onload(evt) {
51 tabBrowser.removeEventListener("load", onload, true);
53 ise(tabBrowser.contentDocument.location.href,
54 "about:accounts?action=signup",
55 "about:accounts should have replaced the tab");
57 // the iframe in about:accounts will still be loading, so we stop
58 // that before resetting the pref.
59 tabBrowser.contentDocument.location.href = "about:blank";
60 Services.prefs.clearUserPref("identity.fxaccounts.remote.signup.uri");
61 done();
62 }, true);
64 gContentAPI.showFirefoxAccounts();
65 });
66 },
67 ];