browser/components/customizableui/test/browser_967000_button_sync.js

Wed, 31 Dec 2014 13:27:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 13:27:57 +0100
branch
TOR_BUG_3246
changeset 6
8bccb770b82d
permissions
-rw-r--r--

Ignore runtime configuration files generated during quality assurance.

michael@0 1 /* This Source Code Form is subject to the terms of the Mozilla Public
michael@0 2 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 4
michael@0 5 "use strict";
michael@0 6
michael@0 7 let initialLocation = gBrowser.currentURI.spec;
michael@0 8 let newTab = null;
michael@0 9
michael@0 10 add_task(function() {
michael@0 11 info("Check Sync button functionality");
michael@0 12 Services.prefs.setCharPref("identity.fxaccounts.remote.signup.uri", "http://example.com/");
michael@0 13
michael@0 14 // add the Sync button to the panel
michael@0 15 CustomizableUI.addWidgetToArea("sync-button", CustomizableUI.AREA_PANEL);
michael@0 16
michael@0 17 // check the button's functionality
michael@0 18 yield PanelUI.show();
michael@0 19
michael@0 20 let syncButton = document.getElementById("sync-button");
michael@0 21 ok(syncButton, "The Sync button was added to the Panel Menu");
michael@0 22 syncButton.click();
michael@0 23
michael@0 24 newTab = gBrowser.selectedTab;
michael@0 25 yield promiseTabLoadEvent(newTab, "about:accounts");
michael@0 26
michael@0 27 is(gBrowser.currentURI.spec, "about:accounts", "Firefox Sync page opened");
michael@0 28 ok(!isPanelUIOpen(), "The panel closed");
michael@0 29
michael@0 30 if(isPanelUIOpen()) {
michael@0 31 let panelHidePromise = promisePanelHidden(window);
michael@0 32 PanelUI.hide();
michael@0 33 yield panelHidePromise;
michael@0 34 }
michael@0 35 });
michael@0 36
michael@0 37 add_task(function asyncCleanup() {
michael@0 38 Services.prefs.clearUserPref("identity.fxaccounts.remote.signup.uri");
michael@0 39 // reset the panel UI to the default state
michael@0 40 yield resetCustomization();
michael@0 41 ok(CustomizableUI.inDefaultState, "The panel UI is in default state again.");
michael@0 42
michael@0 43 // restore the tabs
michael@0 44 gBrowser.addTab(initialLocation);
michael@0 45 gBrowser.removeTab(newTab);
michael@0 46 });

mercurial