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