Bug 1249119 - Let shared-head helper cleanup tests instead of duplicating the effort in inspector head. r=pbro
authorAlexandre Poirot <poirot.alex@gmail.com>
Wed, 19 Oct 2016 05:26:08 -0700
changeset 428691 46b32222e682b25578d090664a9c32f389e9dae4
parent 428690 f08cf9dc4b927f6fe5cc18070c8b2f9e860de45a
child 428692 9ebb57bb1d766831114afb897fc13840ce8f2896
push id33405
push userbcampen@mozilla.com
push dateMon, 24 Oct 2016 15:32:53 +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);
 };
 
 /**