michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: "use strict"; michael@0: michael@0: let initialLocation = gBrowser.currentURI.spec; michael@0: let newTab = null; michael@0: michael@0: add_task(function() { michael@0: info("Check Sync button functionality"); michael@0: Services.prefs.setCharPref("identity.fxaccounts.remote.signup.uri", "http://example.com/"); michael@0: michael@0: // add the Sync button to the panel michael@0: CustomizableUI.addWidgetToArea("sync-button", CustomizableUI.AREA_PANEL); michael@0: michael@0: // check the button's functionality michael@0: yield PanelUI.show(); michael@0: michael@0: let syncButton = document.getElementById("sync-button"); michael@0: ok(syncButton, "The Sync button was added to the Panel Menu"); michael@0: syncButton.click(); michael@0: michael@0: newTab = gBrowser.selectedTab; michael@0: yield promiseTabLoadEvent(newTab, "about:accounts"); michael@0: michael@0: is(gBrowser.currentURI.spec, "about:accounts", "Firefox Sync page opened"); michael@0: ok(!isPanelUIOpen(), "The panel closed"); michael@0: michael@0: if(isPanelUIOpen()) { michael@0: let panelHidePromise = promisePanelHidden(window); michael@0: PanelUI.hide(); michael@0: yield panelHidePromise; michael@0: } michael@0: }); michael@0: michael@0: add_task(function asyncCleanup() { michael@0: Services.prefs.clearUserPref("identity.fxaccounts.remote.signup.uri"); michael@0: // reset the panel UI to the default state michael@0: yield resetCustomization(); michael@0: ok(CustomizableUI.inDefaultState, "The panel UI is in default state again."); michael@0: michael@0: // restore the tabs michael@0: gBrowser.addTab(initialLocation); michael@0: gBrowser.removeTab(newTab); michael@0: });