|
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 const kTestToolbarId = "test-empty-drag"; |
|
8 |
|
9 // Attempting to switch quickly from one tab to another to see whether the state changes |
|
10 // correctly. |
|
11 add_task(function CheckBasicCustomizeMode() { |
|
12 yield startCustomizing(); |
|
13 ok(CustomizationHandler.isCustomizing(), "We should be in customize mode"); |
|
14 yield endCustomizing(); |
|
15 ok(!CustomizationHandler.isCustomizing(), "We should not be in customize mode"); |
|
16 }); |
|
17 add_task(function CheckQuickCustomizeModeSwitch() { |
|
18 let tab1 = gBrowser.addTab("about:newtab"); |
|
19 gBrowser.selectedTab = tab1; |
|
20 let tab2 = gBrowser.addTab("about:customizing"); |
|
21 let tab3 = gBrowser.addTab("about:newtab"); |
|
22 gBrowser.selectedTab = tab2; |
|
23 try { |
|
24 yield waitForCondition(() => CustomizationHandler.isEnteringCustomizeMode); |
|
25 } catch (ex) { |
|
26 Cu.reportError(ex); |
|
27 } |
|
28 ok(CustomizationHandler.isEnteringCustomizeMode, "Should be entering customize mode"); |
|
29 gBrowser.selectedTab = tab3; |
|
30 try { |
|
31 yield waitForCondition(() => !CustomizationHandler.isEnteringCustomizeMode && !CustomizationHandler.isCustomizing()); |
|
32 } catch (ex) { |
|
33 Cu.reportError(ex); |
|
34 } |
|
35 ok(!CustomizationHandler.isCustomizing(), "Should not be entering customize mode"); |
|
36 gBrowser.removeTab(tab1); |
|
37 gBrowser.removeTab(tab2); |
|
38 gBrowser.removeTab(tab3); |
|
39 }); |
|
40 |
|
41 add_task(function asyncCleanup() { |
|
42 yield endCustomizing(); |
|
43 }); |
|
44 |