Back out 1b87e7511983 (bug 940954) on suspicion of causing b2g desktop Mac sqlite troubles
authorPhil Ringnalda <philringnalda@gmail.com>
Tue, 02 Dec 2014 18:40:15 -0800
changeset 218272 4a8fb3fdb4211c737f9eb613ad233daf38ec9aa0
parent 218271 5b8a4fcf2894ce919b1df4adc213ae83cc04a5ae
child 218273 b68cac7a8a91f2de14db9617ad7e8c9cfacb39ef
push id27925
push usercbook@mozilla.com
push dateWed, 03 Dec 2014 12:32:33 +0000
treeherdermozilla-central@59b7bf5d119d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs940954
milestone37.0a1
backs out1b87e75119839c47d4d398cae04233e2b0927c34
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Back out 1b87e7511983 (bug 940954) on suspicion of causing b2g desktop Mac sqlite troubles CLOSED TREE
testing/marionette/client/marionette/geckoinstance.py
testing/marionette/client/marionette/marionette.py
testing/marionette/client/marionette/tests/unit/test_profile_management.py
--- a/testing/marionette/client/marionette/geckoinstance.py
+++ b/testing/marionette/client/marionette/geckoinstance.py
@@ -25,46 +25,39 @@ class GeckoInstance(object):
                       "browser.displayedE10SPrompt": 5,
                       "browser.displayedE10SPrompt.1": 5,
                       "browser.displayedE10SPrompt.2": 5,
                       "browser.displayedE10SPrompt.3": 5,
                       "browser.displayedE10SPrompt.4": 5,
                       "browser.tabs.remote.autostart.1": False,
                       "browser.tabs.remote.autostart.2": False}
 
-    def __init__(self, host, port, bin, profile=None, app_args=None, symbols_path=None,
-                  gecko_log=None, prefs=None, ):
+    def __init__(self, host, port, bin, profile, app_args=None, symbols_path=None,
+                  gecko_log=None, prefs=None):
         self.marionette_host = host
         self.marionette_port = port
         self.bin = bin
-        # Check if it is a Profile object or a path to profile
-        self.profile = None
-        if isinstance(profile, Profile):
-            self.profile = profile
-        else:
-            self.profile_path = profile
+        self.profile_path = profile
         self.prefs = prefs
         self.app_args = app_args or []
         self.runner = None
         self.symbols_path = symbols_path
         self.gecko_log = gecko_log
 
     def start(self):
         profile_args = {"preferences": deepcopy(self.required_prefs)}
         profile_args["preferences"]["marionette.defaultPrefs.port"] = self.marionette_port
         if self.prefs:
             profile_args["preferences"].update(self.prefs)
-
-        if hasattr(self, "profile_path") and self.profile is None:
-            if not self.profile_path:
-                profile_args["restore"] = False
-                self.profile = Profile(**profile_args)
-            else:
-                profile_args["path_from"] = self.profile_path
-                self.profile = Profile.clone(**profile_args)
+        if not self.profile_path:
+            profile_args["restore"] = False
+            profile = Profile(**profile_args)
+        else:
+            profile_args["path_from"] = self.profile_path
+            profile = Profile.clone(**profile_args)
 
         process_args = {
             'processOutputLine': [NullOutput()],
         }
 
         if self.gecko_log == '-':
             process_args['stream'] = sys.stdout
         else:
@@ -103,38 +96,30 @@ class GeckoInstance(object):
         env = os.environ.copy()
 
         # environment variables needed for crashreporting
         # https://developer.mozilla.org/docs/Environment_variables_affecting_crash_reporting
         env.update({ 'MOZ_CRASHREPORTER': '1',
                      'MOZ_CRASHREPORTER_NO_REPORT': '1', })
         self.runner = Runner(
             binary=self.bin,
-            profile=self.profile,
+            profile=profile,
             cmdargs=['-no-remote', '-marionette'] + self.app_args,
             env=env,
             symbols_path=self.symbols_path,
             process_args=process_args)
         self.runner.start()
 
-    def close(self, restart=False):
-        if not restart:
-            self.profile.cleanup()
-            self.profile = None
-
+    def close(self):
         if self.runner:
             self.runner.stop()
             self.runner.cleanup()
 
-    def restart(self, prefs=None, clean=True):
-        if clean:
-            self.profile.cleanup()
-            self.profile = None
-
-        self.close(restart=True)
+    def restart(self, prefs=None):
+        self.close()
         if prefs:
             self.prefs = prefs
         else:
             self.prefs = None
         self.start()
 
 class B2GDesktopInstance(GeckoInstance):
     required_prefs = {"focusmanager.testmode": True}
--- a/testing/marionette/client/marionette/marionette.py
+++ b/testing/marionette/client/marionette/marionette.py
@@ -470,17 +470,16 @@ class Marionette(object):
                  profile=None, emulator=None, sdcard=None, emulator_img=None,
                  emulator_binary=None, emulator_res=None, connect_to_running_emulator=False,
                  gecko_log=None, homedir=None, baseurl=None, no_window=False, logdir=None,
                  busybox=None, symbols_path=None, timeout=None, socket_timeout=360,
                  device_serial=None, adb_path=None, process_args=None):
         self.host = host
         self.port = self.local_port = port
         self.bin = bin
-        self.profile = profile
         self.instance = None
         self.session = None
         self.session_id = None
         self.window = None
         self.runner = None
         self.emulator = None
         self.extra_emulators = []
         self.baseurl = baseurl
@@ -508,33 +507,33 @@ class Marionette(object):
                     config.read(os.path.join(os.path.dirname(bin), 'application.ini'))
                     app = config.get('App', 'Name')
                     instance_class = geckoinstance.apps[app.lower()]
                 except (ConfigParser.NoOptionError,
                         ConfigParser.NoSectionError,
                         KeyError):
                     instance_class = geckoinstance.GeckoInstance
             self.instance = instance_class(host=self.host, port=self.port,
-                                           bin=self.bin, profile=self.profile,
+                                           bin=self.bin, profile=profile,
                                            app_args=app_args, symbols_path=symbols_path,
                                            gecko_log=gecko_log)
             self.instance.start()
             assert(self.wait_for_port()), "Timed out waiting for port!"
 
         if emulator:
             self.runner = B2GEmulatorRunner(b2g_home=homedir,
                                             no_window=self.no_window,
                                             logdir=logdir,
                                             arch=emulator,
                                             sdcard=sdcard,
                                             symbols_path=symbols_path,
                                             binary=emulator_binary,
                                             userdata=emulator_img,
                                             resolution=emulator_res,
-                                            profile=self.profile,
+                                            profile=profile,
                                             adb_path=adb_path,
                                             process_args=process_args)
             self.emulator = self.runner.device
             self.emulator.start()
             self.port = self.emulator.setup_port_forwarding(remote_port=self.port)
             assert(self.emulator.wait_for_port(self.port)), "Timed out waiting for port!"
 
         if connect_to_running_emulator:
@@ -769,30 +768,30 @@ class Marionette(object):
         self.set_context(self.CONTEXT_CONTENT)
         if not pref_exists:
             self.delete_session()
             self.instance.restart(prefs)
             assert(self.wait_for_port()), "Timed out waiting for port!"
             self.start_session()
             self._reset_timeouts()
 
-    def restart(self, clean=False):
+    def restart_with_clean_profile(self):
         """
         This will terminate the currently running instance, and spawn a new instance
-        with the same profile and then reuse the session id when creating a session again.
+        with a clean profile.
 
         : param prefs: A dictionary whose keys are preference names.
         """
         if not self.instance:
-            raise errors.MarionetteException("restart can only be called " \
+            raise errors.MarionetteException("enforce_gecko_prefs can only be called " \
                                              "on gecko instances launched by Marionette")
         self.delete_session()
-        self.instance.restart(clean=clean)
+        self.instance.restart()
         assert(self.wait_for_port()), "Timed out waiting for port!"
-        self.start_session(session_id=self.session_id)
+        self.start_session()
         self._reset_timeouts()
 
     def absolute_url(self, relative_url):
         '''
         Returns an absolute url for files served from Marionette's www directory.
 
         :param relative_url: The url of a static file, relative to Marionette's www directory.
         '''
--- a/testing/marionette/client/marionette/tests/unit/test_profile_management.py
+++ b/testing/marionette/client/marionette/tests/unit/test_profile_management.py
@@ -22,17 +22,11 @@ class TestLog(MarionetteTestCase):
     def test_change_preset(self):
         bool_value = self.marionette.execute_script("return SpecialPowers.getBoolPref('marionette.test.bool');")
         self.assertTrue(bool_value)
         self.marionette.enforce_gecko_prefs({"marionette.test.bool": False})
         bool_value = self.marionette.execute_script("return SpecialPowers.getBoolPref('marionette.test.bool');")
         self.assertFalse(bool_value)
 
     def test_clean_profile(self):
-        self.marionette.restart(clean=True)
+        self.marionette.restart_with_clean_profile()
         with self.assertRaisesRegexp(JavascriptException, "Error getting pref"):
             bool_value = self.marionette.execute_script("return SpecialPowers.getBoolPref('marionette.test.bool');")
-
-    def test_can_restart_the_browser(self):
-        self.marionette.enforce_gecko_prefs({"marionette.test.restart": True})
-        self.marionette.restart()
-        bool_value = self.marionette.execute_script("return SpecialPowers.getBoolPref('marionette.test.restart');")
-        self.assertTrue(bool_value)
\ No newline at end of file