Bug 1290186 - Workaround content process shutdown kills in Firefox UI tests by disabling timeout for some tests. r?whimboo draft
authorMike Conley <mconley@mozilla.com>
Mon, 08 Aug 2016 10:47:36 -0400
changeset 398553 2e1405dcbb06ece26a5e948439aa5399ce697e50
parent 397822 e78975b53563d80c99ebfbdf8a9fbf6b829a8a48
child 527698 d01d930afba41b98e3cea607577d4ffc14f8d75a
push id25571
push usermconley@mozilla.com
push dateTue, 09 Aug 2016 12:34:31 +0000
reviewerswhimboo
bugs1290186
milestone51.0a1
Bug 1290186 - Workaround content process shutdown kills in Firefox UI tests by disabling timeout for some tests. r?whimboo MozReview-Commit-ID: KiE9xbEWzIo
testing/firefox-ui/tests/puppeteer/manifest.ini
testing/firefox-ui/tests/puppeteer/test_windows.py
--- a/testing/firefox-ui/tests/puppeteer/manifest.ini
+++ b/testing/firefox-ui/tests/puppeteer/manifest.ini
@@ -15,9 +15,8 @@ tags = remote
 [test_about_window.py]
 [test_menubar.py]
 [test_notifications.py]
 [test_page_info_window.py]
 [test_tabbar.py]
 [test_toolbars.py]
 tags = remote
 [test_windows.py]
-skip-if = e10s # Bug 1292471
--- a/testing/firefox-ui/tests/puppeteer/test_windows.py
+++ b/testing/firefox-ui/tests/puppeteer/test_windows.py
@@ -1,28 +1,47 @@
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 from marionette_driver import By, Wait
-from marionette_driver.errors import NoSuchWindowException, TimeoutException
+from marionette_driver.errors import NoSuchWindowException
 
 import firefox_puppeteer.errors as errors
 
 from firefox_puppeteer.ui.windows import BaseWindow
 from firefox_ui_harness.testcases import FirefoxTestCase
 
 
-class TestWindows(FirefoxTestCase):
+class BaseWindowTestCase(FirefoxTestCase):
+    def setUp(self):
+        """
+        These tests open and close windows pretty rapidly, which
+        (since bug 1261842) can cause content processes to be
+        spawned and discarded in large numbers. By default, Firefox
+        has a 5 second timeout for shutting down content processes,
+        but we can get into cases where the content process just
+        doesn't have enough time to get itself all sorted before
+        the timeout gets hit, which results in the parent killing
+        the content process manually, which generates a crash report,
+        which causes these tests to orange. We side-step this by
+        setting dom.ipc.tabs.shutdownTimeoutSecs to 0, which disables
+        the shutdown timer.
+        """
+        FirefoxTestCase.setUp(self)
+        self.prefs.set_pref('dom.ipc.tabs.shutdownTimeoutSecs', 0)
+
+
+class TestWindows(BaseWindowTestCase):
 
     def tearDown(self):
         try:
             self.windows.close_all([self.browser])
         finally:
-            FirefoxTestCase.tearDown(self)
+            BaseWindowTestCase.tearDown(self)
 
     def test_windows(self):
         url = self.marionette.absolute_url('layout/mozilla.html')
 
         # Open two more windows
         for index in range(0, 2):
             self.marionette.execute_script(""" window.open(); """)
 
@@ -58,23 +77,23 @@ class TestWindows(FirefoxTestCase):
                           self.windows.switch_to, lambda win: False)
 
         self.windows.close_all([self.browser])
         self.browser.switch_to()
 
         self.assertEqual(len(self.windows.all), 1)
 
 
-class TestBaseWindow(FirefoxTestCase):
+class TestBaseWindow(BaseWindowTestCase):
 
     def tearDown(self):
         try:
             self.windows.close_all([self.browser])
         finally:
-            FirefoxTestCase.tearDown(self)
+            BaseWindowTestCase.tearDown(self)
 
     def test_basics(self):
         # force BaseWindow instance
         win1 = BaseWindow(lambda: self.marionette, self.browser.handle)
 
         self.assertEquals(win1.handle, self.marionette.current_chrome_window_handle)
         self.assertEquals(win1.window_element,
                           self.marionette.find_element(By.CSS_SELECTOR, ':root'))
@@ -168,23 +187,23 @@ class TestBaseWindow(FirefoxTestCase):
 
         # Close win2, and check that it keeps active but looses focus
         win2.switch_to()
         win2.close()
 
         win1.switch_to()
 
 
-class TestBrowserWindow(FirefoxTestCase):
+class TestBrowserWindow(BaseWindowTestCase):
 
     def tearDown(self):
         try:
             self.windows.close_all([self.browser])
         finally:
-            FirefoxTestCase.tearDown(self)
+            BaseWindowTestCase.tearDown(self)
 
     def test_basic(self):
         self.assertNotEqual(self.browser.dtds, [])
         self.assertNotEqual(self.browser.properties, [])
 
         self.assertFalse(self.browser.is_private)
 
         self.assertIsNotNone(self.browser.menubar)