Bug 1249119 - Let shared-head helper cleanup tests instead of duplicating the effort in inspector head. r=pbro draft
authorAlexandre Poirot <poirot.alex@gmail.com>
Wed, 19 Oct 2016 05:26:08 -0700
changeset 427782 9e8da4d69b92a5ed29a72c8ed845e87095bcef85
parent 427781 b9bcce380d5ba721763c10333b8916a7ba8bf17d
child 427783 6621dbe5dc15405a85b37e5bba4cfa9dd160f226
push id33111
push userbmo:poirot.alex@gmail.com
push dateThu, 20 Oct 2016 21:28:50 +0000
reviewerspbro
bugs1249119
milestone52.0a1
Bug 1249119 - Let shared-head helper cleanup tests instead of duplicating the effort in inspector head. r=pbro MozReview-Commit-ID: 2GxvXl3GTy8
devtools/client/inspector/test/browser_inspector_portrait_mode.js
devtools/client/inspector/test/head.js
--- a/devtools/client/inspector/test/browser_inspector_portrait_mode.js
+++ b/devtools/client/inspector/test/browser_inspector_portrait_mode.js
@@ -30,18 +30,17 @@ add_task(function* () {
   info("Resize toolbox window to force inspector to portrait mode");
   let onClassnameMutation = waitForClassMutation(splitter);
   hostWindow.resizeTo(500, 500);
   yield onClassnameMutation;
 
   ok(splitter.classList.contains("horz"), "Splitter is in horizontal mode");
 
   info("Close the inspector");
-  let target = TargetFactory.forTab(gBrowser.selectedTab);
-  yield gDevTools.closeToolbox(target);
+  yield gDevTools.closeToolbox(toolbox.target);
 
   info("Reopen inspector");
   ({ inspector, toolbox } = yield openInspector("window"));
 
   // Devtools window should still be 500px * 500px, inspector should still be in portrait.
   splitter = inspector.panelDoc.querySelector(".inspector-sidebar-splitter");
   ok(splitter.classList.contains("horz"), "Splitter is in horizontal mode");
 
--- a/devtools/client/inspector/test/head.js
+++ b/devtools/client/inspector/test/head.js
@@ -42,28 +42,21 @@ registerCleanupFunction(() => {
   flags.testing = false;
 });
 
 registerCleanupFunction(() => {
   Services.prefs.clearUserPref("devtools.inspector.activeSidebar");
 });
 
 registerCleanupFunction(function* () {
-  let target = TargetFactory.forTab(gBrowser.selectedTab);
-  yield gDevTools.closeToolbox(target);
-
   // Move the mouse outside inspector. If the test happened fake a mouse event
   // somewhere over inspector the pointer is considered to be there when the
   // next test begins. This might cause unexpected events to be emitted when
   // another test moves the mouse.
   EventUtils.synthesizeMouseAtPoint(1, 1, {type: "mousemove"}, window);
-
-  while (gBrowser.tabs.length > 1) {
-    gBrowser.removeCurrentTab();
-  }
 });
 
 var navigateTo = function (toolbox, url) {
   let activeTab = toolbox.target.activeTab;
   return activeTab.navigateTo(url);
 };
 
 /**