Bug 1328411 - Move e10s prefs setup to BaseMarionetteTestRunner; r=automatedtester
authorMaja Frydrychowicz <mjzffr@gmail.com>
Wed, 04 Jan 2017 12:06:06 -0500
changeset 456695 8a7c1bfc71865a14d10d0ff5432d8513b2d78d24
parent 456694 b8929b9614575d663806d5a16cc97d9db56c554e
child 456696 90c553c768ef616e39de5bf524c285f7ae42f6c1
push id40575
push userjwwang@mozilla.com
push dateFri, 06 Jan 2017 02:27:46 +0000
reviewersautomatedtester
bugs1328411
milestone53.0a1
Bug 1328411 - Move e10s prefs setup to BaseMarionetteTestRunner; r=automatedtester This allows the |e10s| argument in BaseMarionetteTestRunner to enable e10s in the browser without depending on |BaseMarionetteArguments.verify_usage|. Unlike other args like |jsdebugger|, the |e10s| argument is found in both BaseMarionetteArguments and BaseMarionetteTestArguments, so it's more intuitive to pass it along and perform all the associated setup in BaseMarionetteTestRunner. MozReview-Commit-ID: JCvxdazjq8p
testing/marionette/harness/marionette_harness/runner/base.py
testing/marionette/harness/marionette_harness/tests/harness_unit/conftest.py
testing/marionette/harness/marionette_harness/tests/harness_unit/test_marionette_runner.py
--- a/testing/marionette/harness/marionette_harness/runner/base.py
+++ b/testing/marionette/harness/marionette_harness/runner/base.py
@@ -437,23 +437,16 @@ class BaseMarionetteArguments(ArgumentPa
                 self.error('Chunk to run must be between 1 and {}.'.format(args.total_chunks))
 
         if args.jsdebugger:
             args.app_args.append('-jsdebugger')
             args.socket_timeout = None
 
         args.prefs = self._get_preferences(args.prefs_files, args.prefs_args)
 
-        if args.e10s:
-            args.prefs.update({
-                'browser.tabs.remote.autostart': True,
-                'browser.tabs.remote.force-enable': True,
-                'extensions.e10sBlocksEnabling': False
-            })
-
         for container in self.argument_containers:
             if hasattr(container, 'verify_usage_handler'):
                 container.verify_usage_handler(args)
 
         return args
 
 
 class RemoteMarionetteArguments(object):
@@ -545,16 +538,22 @@ class BaseMarionetteTestRunner(object):
         self.test_tags = test_tags
         self.startup_timeout = startup_timeout
         self.workspace = workspace
         # If no workspace is set, default location for gecko.log is .
         # and default location for profile is TMP
         self.workspace_path = workspace or os.getcwd()
         self.verbose = verbose
         self.e10s = e10s
+        if self.e10s:
+            self.prefs.update({
+                'browser.tabs.remote.autostart': True,
+                'browser.tabs.remote.force-enable': True,
+                'extensions.e10sBlocksEnabling': False
+            })
 
         def gather_debug(test, status):
             # No screenshots and page source for skipped tests
             if status == "SKIP":
                 return
 
             rv = {}
             marionette = test._marionette_weakref()
--- a/testing/marionette/harness/marionette_harness/tests/harness_unit/conftest.py
+++ b/testing/marionette/harness/marionette_harness/tests/harness_unit/conftest.py
@@ -53,21 +53,17 @@ def mach_parsed_kwargs(logger):
         'log_raw_level': None,
         'log_tbpl': None,
         'log_tbpl_buffer': None,
         'log_tbpl_compact': None,
         'log_tbpl_level': None,
         'log_unittest': None,
         'log_xunit': None,
         'logger_name': 'Marionette-based Tests',
-        'prefs': {
-            'browser.tabs.remote.autostart': True,
-            'browser.tabs.remote.force-enable': True,
-            'extensions.e10sBlocksEnabling': False,
-        },
+        'prefs': {},
         'prefs_args': None,
         'prefs_files': None,
         'profile': None,
         'pydebugger': None,
         'repeat': 0,
         'server_root': None,
         'shuffle': False,
         'shuffle_seed': 2276870381009474531,
--- a/testing/marionette/harness/marionette_harness/tests/harness_unit/test_marionette_runner.py
+++ b/testing/marionette/harness/marionette_harness/tests/harness_unit/test_marionette_runner.py
@@ -120,16 +120,19 @@ def test_args_passed_to_driverclass(mock
 def test_build_kwargs_basic_args(build_kwargs_using):
     '''Test the functionality of runner._build_kwargs:
     make sure that basic arguments (those which should
     always be included, irrespective of the runner's settings)
     get passed to the call to runner.driverclass'''
 
     basic_args = ['socket_timeout', 'prefs',
                   'startup_timeout', 'verbose', 'symbols_path']
+    args_dict = {a: getattr(sentinel, a) for a in basic_args}
+    # Mock an update method to work with calls to MarionetteTestRunner()
+    args_dict['prefs'].update = Mock(return_value={})
     built_kwargs = build_kwargs_using([(a, getattr(sentinel, a)) for a in basic_args])
     for arg in basic_args:
         assert built_kwargs[arg] is getattr(sentinel, arg)
 
 
 @pytest.mark.parametrize('workspace', ['path/to/workspace', None])
 def test_build_kwargs_with_workspace(build_kwargs_using, workspace):
     built_kwargs = build_kwargs_using({'workspace': workspace})