Bug 1511311 - [marionette] GeckoInstance classes should not overwrite already set custom preferences. r=automatedtester
authorHenrik Skupin <mail@hskupin.info>
Fri, 30 Nov 2018 13:27:22 +0000
changeset 448968 cd370c35d88d82c719e7b3d70ae1da003c8cb7f6
parent 448967 dfe85e4f62c30675e0da05456e2a0b2eb473957c
child 448969 647ade4da0fba74a268aab079677cb47f20f036e
push id35139
push userccoroiu@mozilla.com
push dateSat, 01 Dec 2018 02:30:08 +0000
treeherdermozilla-central@22425b629a9d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersautomatedtester
bugs1511311
milestone65.0a1
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
Bug 1511311 - [marionette] GeckoInstance classes should not overwrite already set custom preferences. r=automatedtester Custom preferences as passed into both classes via the constructor are getting set in the base GeckoInstance class. But both the DesktopInstance and FennecInstance classes could override those custom preferences if they have the same preference set as required preference. As such the custom preference doesn't have any effect. This patch allows both classes to override required prefs with a different value. Differential Revision: https://phabricator.services.mozilla.com/D13522
testing/marionette/client/marionette_driver/geckoinstance.py
--- a/testing/marionette/client/marionette_driver/geckoinstance.py
+++ b/testing/marionette/client/marionette_driver/geckoinstance.py
@@ -400,18 +400,21 @@ class FennecInstance(GeckoInstance):
         # Do not allow background tabs to be zombified, otherwise for tests that
         # open additional tabs, the test harness tab itself might get unloaded
         "browser.tabs.disableBackgroundZombification": True,
     }
 
     def __init__(self, emulator_binary=None, avd_home=None, avd=None,
                  adb_path=None, serial=None, connect_to_running_emulator=False,
                  package_name=None, *args, **kwargs):
+        required_prefs = deepcopy(FennecInstance.fennec_prefs)
+        required_prefs.update(kwargs.get("prefs", {}))
+
         super(FennecInstance, self).__init__(*args, **kwargs)
-        self.required_prefs.update(FennecInstance.fennec_prefs)
+        self.required_prefs.update(required_prefs)
 
         self.runner_class = FennecEmulatorRunner
         # runner args
         self._package_name = package_name
         self.emulator_binary = emulator_binary
         self.avd_home = avd_home
         self.adb_path = adb_path
         self.avd = avd
@@ -578,18 +581,21 @@ class DesktopInstance(GeckoInstance):
         "browser.warnOnQuit": False,
 
         # Disable first-run welcome page
         "startup.homepage_welcome_url": "about:blank",
         "startup.homepage_welcome_url.additional": "",
     }
 
     def __init__(self, *args, **kwargs):
+        required_prefs = deepcopy(DesktopInstance.desktop_prefs)
+        required_prefs.update(kwargs.get("prefs", {}))
+
         super(DesktopInstance, self).__init__(*args, **kwargs)
-        self.required_prefs.update(DesktopInstance.desktop_prefs)
+        self.required_prefs.update(required_prefs)
 
 
 class NullOutput(object):
     def __call__(self, line):
         pass
 
 
 apps = {