browser/components/customizableui/test/browser_889120_customize_tab_merging.js

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/browser/components/customizableui/test/browser_889120_customize_tab_merging.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,44 @@
     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 +const kTestToolbarId = "test-empty-drag";
    1.11 +
    1.12 +// Attempting to switch quickly from one tab to another to see whether the state changes
    1.13 +// correctly.
    1.14 +add_task(function CheckBasicCustomizeMode() {
    1.15 +  yield startCustomizing();
    1.16 +  ok(CustomizationHandler.isCustomizing(), "We should be in customize mode");
    1.17 +  yield endCustomizing();
    1.18 +  ok(!CustomizationHandler.isCustomizing(), "We should not be in customize mode");
    1.19 +});
    1.20 +add_task(function CheckQuickCustomizeModeSwitch() {
    1.21 +  let tab1 = gBrowser.addTab("about:newtab");
    1.22 +  gBrowser.selectedTab = tab1;
    1.23 +  let tab2 = gBrowser.addTab("about:customizing");
    1.24 +  let tab3 = gBrowser.addTab("about:newtab");
    1.25 +  gBrowser.selectedTab = tab2;
    1.26 +  try {
    1.27 +    yield waitForCondition(() => CustomizationHandler.isEnteringCustomizeMode);
    1.28 +  } catch (ex) {
    1.29 +    Cu.reportError(ex);
    1.30 +  }
    1.31 +  ok(CustomizationHandler.isEnteringCustomizeMode, "Should be entering customize mode");
    1.32 +  gBrowser.selectedTab = tab3;
    1.33 +  try {
    1.34 +    yield waitForCondition(() => !CustomizationHandler.isEnteringCustomizeMode && !CustomizationHandler.isCustomizing());
    1.35 +  } catch (ex) {
    1.36 +    Cu.reportError(ex);
    1.37 +  }
    1.38 +  ok(!CustomizationHandler.isCustomizing(), "Should not be entering customize mode");
    1.39 +  gBrowser.removeTab(tab1);
    1.40 +  gBrowser.removeTab(tab2);
    1.41 +  gBrowser.removeTab(tab3);
    1.42 +});
    1.43 +
    1.44 +add_task(function asyncCleanup() {
    1.45 +  yield endCustomizing();
    1.46 +});
    1.47 +

mercurial