Bug 1386828 - Use marionette.close to close tabs. r=whimboo, a=test-only
authorEric Rahm <erahm@mozilla.com>
Thu, 10 Aug 2017 11:19:08 -0700
changeset 421117 2592fec1032484952cb8da4c5ab333f484958872
parent 421116 be09ce5ce9b5ef166d4903c3a998f99b36f0fdd8
child 421118 9c30a550dcd462a8109ba30231acf0cc1c052022
push id7606
push userryanvm@gmail.com
push dateFri, 11 Aug 2017 20:45:35 +0000
treeherdermozilla-beta@6ea7b3eb8990 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerswhimboo, test-only
bugs1386828
milestone56.0
Bug 1386828 - Use marionette.close to close tabs. r=whimboo, a=test-only MozReview-Commit-ID: AL5yTSbX5Mn
testing/awsy/awsy/test_memory_usage.py
--- a/testing/awsy/awsy/test_memory_usage.py
+++ b/testing/awsy/awsy/test_memory_usage.py
@@ -103,30 +103,20 @@ class TestMemoryUsage(MarionetteTestCase
                     shutil.copy2(file, os.environ["MOZ_UPLOAD_DIR"])
 
         self.logger.info("done tearing down!")
 
     def reset_state(self):
         self._pages_loaded = 0
 
         # Close all tabs except one
-        for x in range(len(self.marionette.window_handles) - 1):
-            self.logger.info("closing window")
-            try:
-                result = self.marionette.execute_script("gBrowser.removeCurrentTab();",
-                                                        script_timeout=180000)
-            except JavascriptException, e:
-                self.logger.error("gBrowser.removeCurrentTab() JavaScript error: %s" % e)
-            except ScriptTimeoutException:
-                self.logger.error("gBrowser.removeCurrentTab() timed out")
-            except:
-                self.logger.error("gBrowser.removeCurrentTab() Unexpected error: %s" % sys.exc_info()[0])
-            else:
-                self.logger.info(result)
-            time.sleep(0.25)
+        for x in self.marionette.window_handles[1:]:
+            self.logger.info("closing window: %s" % x)
+            self.marionette.switch_to_window(x)
+            self.marionette.close()
 
         self._tabs = self.marionette.window_handles
         self.marionette.switch_to_window(self._tabs[0])
 
     def clear_preloaded_browser(self):
         """
         Clears out the preloaded browser.