Bug 1347514 - Regression test. r?dao draft
authorMike Conley <mconley@mozilla.com>
Mon, 20 Mar 2017 12:00:33 -0400
changeset 502199 ac3fd516cebc3ef09377124b244d8a9d52059a1f
parent 501869 5900d940429f30ac89b84aa184e69a5d79edde98
child 550106 f99f8d686407c6c2b6e54df4c71857311a97bbf8
push id50225
push usermconley@mozilla.com
push dateTue, 21 Mar 2017 13:52:15 +0000
reviewersdao
bugs1347514
milestone55.0a1
Bug 1347514 - Regression test. r?dao MozReview-Commit-ID: 98EE9BUsVtz
browser/components/customizableui/test/browser.ini
browser/components/customizableui/test/browser_exit_background_customize_mode.js
--- a/browser/components/customizableui/test/browser.ini
+++ b/browser/components/customizableui/test/browser.ini
@@ -143,12 +143,13 @@ skip-if = os == "linux" # crashing on Li
 tags = fullscreen
 skip-if = os == "mac"
 [browser_1087303_button_preferences.js]
 [browser_1089591_still_customizable_after_reset.js]
 [browser_1096763_seen_widgets_post_reset.js]
 [browser_1161838_inserted_new_default_buttons.js]
 [browser_bootstrapped_custom_toolbar.js]
 [browser_customizemode_contextmenu_menubuttonstate.js]
+[browser_exit_background_customize_mode.js]
 [browser_panel_toggle.js]
 [browser_switch_to_customize_mode.js]
 [browser_synced_tabs_menu.js]
 [browser_check_tooltips_in_navbar.js]
new file mode 100644
--- /dev/null
+++ b/browser/components/customizableui/test/browser_exit_background_customize_mode.js
@@ -0,0 +1,36 @@
+"use strict";
+
+/**
+ * Tests that if customize mode is currently attached to a background
+ * tab, and that tab browses to a new location, that customize mode
+ * is detached from that tab.
+ */
+add_task(function* test_exit_background_customize_mode() {
+  let nonCustomizingTab = gBrowser.selectedTab;
+
+  Assert.equal(gBrowser.tabContainer.querySelector("tab[customizemode=true]"),
+               null,
+               "Should not have a tab marked as being the customize tab now.");
+
+  yield startCustomizing();
+  is(gBrowser.tabs.length, 2, "Should have 2 tabs");
+
+  let custTab = gBrowser.selectedTab;
+
+  let finishedCustomizing = BrowserTestUtils.waitForEvent(gNavToolbox, "aftercustomization");
+  yield BrowserTestUtils.switchTab(gBrowser, nonCustomizingTab);
+  yield finishedCustomizing;
+
+  custTab.linkedBrowser.loadURI("http://example.com");
+  yield BrowserTestUtils.browserLoaded(custTab.linkedBrowser);
+
+  Assert.equal(gBrowser.tabContainer.querySelector("tab[customizemode=true]"),
+               null,
+               "Should not have a tab marked as being the customize tab now.");
+
+  yield startCustomizing();
+  is(gBrowser.tabs.length, 3, "Should have 3 tabs now");
+
+  yield endCustomizing();
+  yield BrowserTestUtils.removeTab(custTab);
+});