Backed out changeset 3b96e18dd924 (bug 1030442) for Windows Marionette failures.
authorRyan VanderMeulen <ryanvm@gmail.com>
Tue, 15 Jul 2014 12:23:47 -0400
changeset 216100 c54077a44ad85afdf7c792a7dede4515c8330950
parent 216099 7441f4dde492536449823c3e1a6f5ee441b7775e
child 216101 2025d6c5049956490c5c4faae6915730ce6b3ef5
push id515
push userraliiev@mozilla.com
push dateMon, 06 Oct 2014 12:51:51 +0000
treeherdermozilla-release@267c7a481bef [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1030442
milestone33.0a1
backs out3b96e18dd924763ddd1fb94ab1e7056cb41d2d31
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
Backed out changeset 3b96e18dd924 (bug 1030442) for Windows Marionette failures.
testing/marionette/client/marionette/geckoinstance.py
testing/marionette/client/marionette/marionette.py
testing/marionette/client/marionette/tests/unit/test_profile_management.py
testing/marionette/client/marionette/tests/unit/unit-tests.ini
--- a/testing/marionette/client/marionette/geckoinstance.py
+++ b/testing/marionette/client/marionette/geckoinstance.py
@@ -1,13 +1,12 @@
 # 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 copy import deepcopy
 import os
 import time
 
 from mozprofile import Profile
 from mozrunner import Runner
 
 
 class GeckoInstance(object):
@@ -17,31 +16,28 @@ class GeckoInstance(object):
                       "marionette.logging": True,
                       "startup.homepage_welcome_url": "about:blank",
                       "browser.shell.checkDefaultBrowser": False,
                       "browser.startup.page": 0,
                       "browser.sessionstore.resume_from_crash": False,
                       "browser.warnOnQuit": False}
 
     def __init__(self, host, port, bin, profile, app_args=None, symbols_path=None,
-                  gecko_log=None, prefs=None):
+                  gecko_log=None):
         self.marionette_host = host
         self.marionette_port = port
         self.bin = bin
         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)}
-        if self.prefs:
-            profile_args["preferences"].update(self.prefs)
+        profile_args = {"preferences": self.required_prefs}
         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)
 
         if self.gecko_log is None:
@@ -74,23 +70,16 @@ class GeckoInstance(object):
     def check_for_crashes(self):
         return self.runner.check_for_crashes()
 
     def close(self):
         if self.runner:
             self.runner.stop()
             self.runner.cleanup()
 
-    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}
 
     def __init__(self, **kwargs):
         super(B2GDesktopInstance, self).__init__(**kwargs)
         self.app_args += ['-chrome', 'chrome://b2g/content/shell.html']
 
--- a/testing/marionette/client/marionette/marionette.py
+++ b/testing/marionette/client/marionette/marionette.py
@@ -1,15 +1,14 @@
 # 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/.
 
 import ConfigParser
 import datetime
-import json
 import os
 import socket
 import StringIO
 import time
 import traceback
 import base64
 
 from application_cache import ApplicationCache
@@ -684,24 +683,16 @@ class Marionette(object):
             elif status == errors.ErrorCodes.FRAME_SEND_NOT_INITIALIZED_ERROR:
                 raise errors.FrameSendNotInitializedError(message=message, status=status, stacktrace=stacktrace)
             elif status == errors.ErrorCodes.FRAME_SEND_FAILURE_ERROR:
                 raise errors.FrameSendFailureError(message=message, status=status, stacktrace=stacktrace)
             else:
                 raise errors.MarionetteException(message=message, status=status, stacktrace=stacktrace)
         raise errors.MarionetteException(message=response, status=500)
 
-    def _reset_timeouts(self):
-        if self.timeout is not None:
-            self.timeouts(self.TIMEOUT_SEARCH, self.timeout)
-            self.timeouts(self.TIMEOUT_SCRIPT, self.timeout)
-            self.timeouts(self.TIMEOUT_PAGE, self.timeout)
-        else:
-            self.timeouts(self.TIMEOUT_PAGE, 30000)
-
     def check_for_crash(self):
         returncode = None
         name = None
         crashed = False
         if self.runner:
             if self.runner.check_for_crashes():
                 returncode = self.emulator.proc.returncode
                 name = 'emulator'
@@ -709,73 +700,16 @@ class Marionette(object):
         elif self.instance:
             if self.instance.check_for_crashes():
                 crashed = True
         if returncode is not None:
             print ('PROCESS-CRASH | %s | abnormal termination with exit code %d' %
                 (name, returncode))
         return crashed
 
-    def enforce_gecko_prefs(self, prefs):
-        """
-        Checks if the running instance has the given prefs. If not, it will kill the
-        currently running instance, and spawn a new instance with the requested preferences
-        : param prefs: A dictionary whose keys are preference names.
-        """
-        if not self.instance:
-            raise errors.MarionetteException("enforce_gecko_prefs can only be called " \
-                                             "on gecko instances launched by Marionette")
-        pref_exists = True
-        self.set_context(self.CONTEXT_CHROME)
-        for pref, value in prefs.iteritems():
-            if type(value) is not str:
-                value = json.dumps(value)
-            pref_exists = self.execute_script("""
-            let prefInterface = Components.classes["@mozilla.org/preferences-service;1"]
-                                          .getService(Components.interfaces.nsIPrefBranch);
-            let pref = '%s';
-            let value = '%s';
-            let type = prefInterface.getPrefType(pref);
-            switch(type) {
-                case prefInterface.PREF_STRING:
-                    return value == prefInterface.getCharPref(pref).toString();
-                case prefInterface.PREF_BOOL:
-                    return value == prefInterface.getBoolPref(pref).toString();
-                case prefInterface.PREF_INT:
-                    return value == prefInterface.getIntPref(pref).toString();
-                case prefInterface.PREF_INVALID:
-                    return false;
-            }
-            """ % (pref, value))
-            if not pref_exists:
-                break
-        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_with_clean_profile(self):
-        """
-        This will terminate the currently running instance, and spawn a new instance
-        with a clean profile.
-
-        : param prefs: A dictionary whose keys are preference names.
-        """
-        if not self.instance:
-            raise errors.MarionetteException("enforce_gecko_prefs can only be called " \
-                                             "on gecko instances launched by Marionette")
-        self.delete_session()
-        self.instance.restart()
-        assert(self.wait_for_port()), "Timed out waiting for port!"
-        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.
         '''
         return "%s%s" % (self.baseurl, relative_url)
 
deleted file mode 100644
--- a/testing/marionette/client/marionette/tests/unit/test_profile_management.py
+++ /dev/null
@@ -1,32 +0,0 @@
-# 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/.
-
-import os
-from errors import JavascriptException
-from marionette_test import MarionetteTestCase
-
-class TestLog(MarionetteTestCase):
-    def setUp(self):
-        MarionetteTestCase.setUp(self)
-        self.marionette.enforce_gecko_prefs({"marionette.test.bool": True, "marionette.test.string": "testing", "marionette.test.int": 3})
-
-    def test_preferences_are_set(self):
-        bool_value = self.marionette.execute_script("return SpecialPowers.getBoolPref('marionette.test.bool');")
-        string_value = self.marionette.execute_script("return SpecialPowers.getCharPref('marionette.test.string');")
-        int_value = self.marionette.execute_script("return SpecialPowers.getIntPref('marionette.test.int');")
-        self.assertTrue(bool_value)
-        self.assertEqual(string_value, "testing")
-        self.assertEqual(int_value, 3)
-
-    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_with_clean_profile()
-        with self.assertRaisesRegexp(JavascriptException, "Error getting pref"):
-            bool_value = self.marionette.execute_script("return SpecialPowers.getBoolPref('marionette.test.bool');")
--- a/testing/marionette/client/marionette/tests/unit/unit-tests.ini
+++ b/testing/marionette/client/marionette/tests/unit/unit-tests.ini
@@ -110,12 +110,10 @@ disabled = "Bug 925688"
 [test_submit.py]
 [test_chrome_async_finish.js]
 [test_screen_orientation.py]
 browser = false
 [test_errors.py]
 
 [test_execute_isolate.py]
 [test_click_scrolling.py]
-[test_profile_management.py]
-b2g = false
 
 [include:oop/manifest.ini]