Bug 969443 - Update CustomizableUI tests to yield on CustomizeMode.reset; r?Gijs draft
authorgasolin <gasolin@gmail.com>
Tue, 29 Mar 2016 15:55:58 +0800
changeset 345456 0d18023fb64d8ca0637a26abd6b728d825fafcc0
parent 345446 a8ec435d22564e64fdd03a71604ebf003b40a48a
child 517196 2c2b81b9f58df7e725fa9ce945bf62902a1b0ac3
push id14090
push userbmo:gasolin@mozilla.com
push dateTue, 29 Mar 2016 10:25:00 +0000
reviewersGijs
bugs969443
milestone48.0a1
Bug 969443 - Update CustomizableUI tests to yield on CustomizeMode.reset; r?Gijs MozReview-Commit-ID: 93fLK4thrgH
browser/components/customizableui/test/browser_1089591_still_customizable_after_reset.js
browser/components/customizableui/test/browser_923857_customize_mode_event_wrapping_during_reset.js
browser/components/customizableui/test/browser_938980_navbar_collapsed.js
browser/components/customizableui/test/browser_970511_undo_restore_default.js
--- a/browser/components/customizableui/test/browser_1089591_still_customizable_after_reset.js
+++ b/browser/components/customizableui/test/browser_1089591_still_customizable_after_reset.js
@@ -3,18 +3,17 @@
 // Dragging the elements again after a reset should work
 add_task(function* () {
   yield startCustomizing();
   let historyButton = document.getElementById("wrapper-history-panelmenu");
   let devButton = document.getElementById("wrapper-developer-button");
 
   ok(historyButton && devButton, "Draggable elements should exist");
   simulateItemDrag(historyButton, devButton);
-  gCustomizeMode.reset();
-  yield waitForCondition(() => !gCustomizeMode.resetting);
+  yield gCustomizeMode.reset();
   ok(CustomizableUI.inDefaultState, "Should be back in default state");
 
   historyButton = document.getElementById("wrapper-history-panelmenu");
   devButton = document.getElementById("wrapper-developer-button");
   ok(historyButton && devButton, "Draggable elements should exist");
   simulateItemDrag(historyButton, devButton);
 
   yield endCustomizing();
--- a/browser/components/customizableui/test/browser_923857_customize_mode_event_wrapping_during_reset.js
+++ b/browser/components/customizableui/test/browser_923857_customize_mode_event_wrapping_during_reset.js
@@ -9,17 +9,16 @@ add_task(function*() {
   yield startCustomizing();
   let devButton = document.getElementById("developer-button");
   let downloadsButton = document.getElementById("downloads-button");
   let searchBox = document.getElementById("search-container");
   let palette = document.getElementById("customization-palette");
   ok(devButton && downloadsButton && searchBox && palette, "Stuff should exist");
   simulateItemDrag(devButton, downloadsButton);
   simulateItemDrag(searchBox, palette);
-  gCustomizeMode.reset();
-  yield waitForCondition(() => !gCustomizeMode.resetting);
+  yield gCustomizeMode.reset();
   ok(CustomizableUI.inDefaultState, "Should be back in default state");
   yield endCustomizing();
 });
 
 add_task(function* asyncCleanup() {
   yield resetCustomization();
 });
--- a/browser/components/customizableui/test/browser_938980_navbar_collapsed.js
+++ b/browser/components/customizableui/test/browser_938980_navbar_collapsed.js
@@ -32,18 +32,17 @@ add_task(function*() {
 
   setToolbarVisibility(bookmarksToolbar, true);
   setToolbarVisibility(navbar, false);
   ok(!bookmarksToolbar.collapsed, "bookmarksToolbar should be visible now");
   ok(navbar.collapsed, "navbar should be collapsed");
   is(CustomizableUI.inDefaultState, false, "Should no longer be in default state");
 
   yield startCustomizing();
-  gCustomizeMode.reset();
-  yield waitForCondition(() => !gCustomizeMode.resetting);
+  yield gCustomizeMode.reset();
   yield endCustomizing();
 
   is(bookmarksToolbar.collapsed, true, "Customization reset should restore collapsed-state to the bookmarks toolbar");
   ok(!tabsToolbar.collapsed, "TabsToolbar should not be collapsed");
   ok(bookmarksToolbar.collapsed, "The bookmarksToolbar should be collapsed after reset");
   ok(CustomizableUI.inDefaultState, "Everything should be back to default state");
 });
 
@@ -56,18 +55,17 @@ add_task(function*() {
   }
   ok(CustomizableUI.inDefaultState, "Everything should be in its default state");
 
   is(menubar.getBoundingClientRect().height, 0, "menubar should be hidden by default");
   setToolbarVisibility(menubar, true);
   isnot(menubar.getBoundingClientRect().height, 0, "menubar should be visible now");
 
   yield startCustomizing();
-  gCustomizeMode.reset();
-  yield waitForCondition(() => !gCustomizeMode.resetting);
+  yield gCustomizeMode.reset();
 
   is(menubar.getAttribute("autohide"), "true", "The menubar should have autohide=true after reset in customization mode");
   is(menubar.getBoundingClientRect().height, 0, "The menubar should have height=0 after reset in customization mode");
 
   yield endCustomizing();
 
   is(menubar.getAttribute("autohide"), "true", "The menubar should have autohide=true after reset");
   is(menubar.getBoundingClientRect().height, 0, "The menubar should have height=0 after reset");
@@ -84,18 +82,17 @@ add_task(function*() {
   is(CustomizableUI.inDefaultState, false, "Should no longer be in default state");
 
   yield startCustomizing();
 
   ok(!bookmarksToolbar.collapsed, "The bookmarksToolbar should be visible before reset");
   ok(!navbar.collapsed, "The navbar should be visible before reset");
   ok(!tabsToolbar.collapsed, "TabsToolbar should not be collapsed");
 
-  gCustomizeMode.reset();
-  yield waitForCondition(() => !gCustomizeMode.resetting);
+  yield gCustomizeMode.reset();
 
   ok(bookmarksToolbar.collapsed, "The bookmarksToolbar should be collapsed after reset");
   ok(!tabsToolbar.collapsed, "TabsToolbar should not be collapsed");
   ok(!navbar.collapsed, "The navbar should still be visible after reset");
   ok(CustomizableUI.inDefaultState, "Everything should be back to default state");
   yield endCustomizing();
 });
 
--- a/browser/components/customizableui/test/browser_970511_undo_restore_default.js
+++ b/browser/components/customizableui/test/browser_970511_undo_restore_default.js
@@ -16,19 +16,19 @@ add_task(function*() {
   let undoResetButton = document.getElementById("customization-undo-reset-button");
   is(undoResetButton.hidden, true, "The undo button is hidden before reset");
 
   yield gCustomizeMode.reset();
 
   ok(CustomizableUI.inDefaultState, "In default state after reset");
   is(undoResetButton.hidden, false, "The undo button is visible after reset");
 
-  undoResetButton.click();
-  yield waitForCondition(() => !gCustomizeMode.resetting);
-  ok(!CustomizableUI.inDefaultState, "Not in default state after reset-undo");
+  yield gCustomizeMode.undoReset()
+
+  ok(!CustomizableUI.inDefaultState, "Not in default state after undo-reset");
   is(undoResetButton.hidden, true, "The undo button is hidden after clicking on the undo button");
   is(CustomizableUI.getPlacementOfWidget(homeButtonId), null, "Home button is in palette");
 
   yield gCustomizeMode.reset();
 });
 
 // Performing an action after a reset will hide the reset button.
 add_task(function*() {