1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/browser/components/customizableui/test/browser_967000_button_sync.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,46 @@ 1.4 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.5 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.6 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.7 + 1.8 +"use strict"; 1.9 + 1.10 +let initialLocation = gBrowser.currentURI.spec; 1.11 +let newTab = null; 1.12 + 1.13 +add_task(function() { 1.14 + info("Check Sync button functionality"); 1.15 + Services.prefs.setCharPref("identity.fxaccounts.remote.signup.uri", "http://example.com/"); 1.16 + 1.17 + // add the Sync button to the panel 1.18 + CustomizableUI.addWidgetToArea("sync-button", CustomizableUI.AREA_PANEL); 1.19 + 1.20 + // check the button's functionality 1.21 + yield PanelUI.show(); 1.22 + 1.23 + let syncButton = document.getElementById("sync-button"); 1.24 + ok(syncButton, "The Sync button was added to the Panel Menu"); 1.25 + syncButton.click(); 1.26 + 1.27 + newTab = gBrowser.selectedTab; 1.28 + yield promiseTabLoadEvent(newTab, "about:accounts"); 1.29 + 1.30 + is(gBrowser.currentURI.spec, "about:accounts", "Firefox Sync page opened"); 1.31 + ok(!isPanelUIOpen(), "The panel closed"); 1.32 + 1.33 + if(isPanelUIOpen()) { 1.34 + let panelHidePromise = promisePanelHidden(window); 1.35 + PanelUI.hide(); 1.36 + yield panelHidePromise; 1.37 + } 1.38 +}); 1.39 + 1.40 +add_task(function asyncCleanup() { 1.41 + Services.prefs.clearUserPref("identity.fxaccounts.remote.signup.uri"); 1.42 + // reset the panel UI to the default state 1.43 + yield resetCustomization(); 1.44 + ok(CustomizableUI.inDefaultState, "The panel UI is in default state again."); 1.45 + 1.46 + // restore the tabs 1.47 + gBrowser.addTab(initialLocation); 1.48 + gBrowser.removeTab(newTab); 1.49 +});