Backed out 3 changesets (bug 1322277) for causing bug 1334149.
authorRyan VanderMeulen <ryanvm@gmail.com>
Sun, 05 Feb 2017 14:24:02 -0500
changeset 375909 53e94ef6ec0ca7576150e1427b19d7d102356113
parent 375908 da7e987a9146ab24a64bc31ea22f75dbc958984b
child 375910 b54c9ddb83f69a3e7c4f355a640105c0479e8e58
push id6996
push userjlorenzo@mozilla.com
push dateMon, 06 Mar 2017 20:48:21 +0000
treeherdermozilla-beta@d89512dab048 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1322277, 1334149
milestone53.0a2
backs oute1949e439f0ea0a1edc865e5f595debdcc9d1d94
c39891c2a2f660d154d8218384e0b7f455bcd38b
2c33db0384377fc05c65ba710db5fbd5d58088a6
Backed out 3 changesets (bug 1322277) for causing bug 1334149. Backed out changeset e1949e439f0e (bug 1322277) Backed out changeset c39891c2a2f6 (bug 1322277) Backed out changeset 2c33db038437 (bug 1322277)
testing/marionette/client/marionette_driver/marionette.py
testing/marionette/harness/marionette_harness/runner/base.py
testing/marionette/harness/marionette_harness/tests/unit/test_capabilities.py
--- a/testing/marionette/client/marionette_driver/marionette.py
+++ b/testing/marionette/client/marionette_driver/marionette.py
@@ -1,14 +1,13 @@
 # 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 base64
-import copy
 import datetime
 import json
 import os
 import socket
 import sys
 import time
 import traceback
 import warnings
@@ -540,17 +539,17 @@ class Alert(object):
         self.marionette._send_message("sendKeysToDialog", body)
 
 
 class Marionette(object):
     """Represents a Marionette connection to a browser or device."""
 
     CONTEXT_CHROME = "chrome"  # non-browser content: windows, dialogs, etc.
     CONTEXT_CONTENT = "content"  # browser content: iframes, divs, etc.
-    DEFAULT_SOCKET_TIMEOUT = 65
+    DEFAULT_SOCKET_TIMEOUT = 60
     DEFAULT_STARTUP_TIMEOUT = 120
     DEFAULT_SHUTDOWN_TIMEOUT = 65  # Firefox will kill hanging threads after 60s
 
     def __init__(self, host="localhost", port=2828, app=None, bin=None,
                  baseurl=None, socket_timeout=DEFAULT_SOCKET_TIMEOUT,
                  startup_timeout=None, **instance_args):
         """Construct a holder for the Marionette connection.
 
@@ -1243,22 +1242,23 @@ class Marionette(object):
         '''
         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 "{0}{1}".format(self.baseurl, relative_url)
 
     @do_process_check
-    def start_session(self, capabilities=None, session_id=None, timeout=60):
+    def start_session(self, desired_capabilities=None, session_id=None, timeout=60):
         """Create a new Marionette session.
 
         This method must be called before performing any other action.
 
-        :param capabilities: An optional dict of desired or required capabilities.
+        :param desired_capabilities: An optional dict of desired
+            capabilities.  This is currently ignored.
         :param timeout: Timeout in seconds for the server to be ready.
         :param session_id: unique identifier for the session. If no session id is
             passed in then one will be generated by the marionette server.
 
         :returns: A dict of the capabilities offered.
 
         """
         self.crashed = 0
@@ -1274,35 +1274,17 @@ class Marionette(object):
             self.port,
             self.socket_timeout)
 
         # Call wait_for_port() before attempting to connect in
         # the event gecko hasn't started yet.
         self.wait_for_port(timeout=timeout)
         self.protocol, _ = self.client.connect()
 
-        if capabilities is not None:
-            caps = copy.deepcopy(capabilities)
-        else:
-            caps = {}
-
-        # Bug 1322277 - Override some default capabilities which are defined by
-        # the Webdriver spec but which don't really apply to tests executed with
-        # the Marionette client. Using "desiredCapabilities" here will allow tests
-        # to override the settings via "desiredCapabilities" and requiredCapabilities".
-        if "desiredCapabilities" not in caps:
-            caps.update({
-                "desiredCapabilities": {
-                    "timeouts": {
-                        "page load": 60000,  # webdriver specifies 300000ms
-                    }
-                }
-            })
-
-        body = {"capabilities": caps, "sessionId": session_id}
+        body = {"capabilities": desired_capabilities, "sessionId": session_id}
         resp = self._send_message("newSession", body)
 
         self.session_id = resp["sessionId"]
         self.session = resp["value"] if self.protocol == 1 else resp["capabilities"]
         # fallback to processId can be removed in Firefox 55
         self.process_id = self.session.get("moz:processID", self.session.get("processId"))
         self.profile = self.session.get("moz:profile")
 
--- a/testing/marionette/harness/marionette_harness/runner/base.py
+++ b/testing/marionette/harness/marionette_harness/runner/base.py
@@ -235,17 +235,17 @@ class MarionetteTextTestRunner(Structure
 
     def run(self, test):
         result = super(MarionetteTextTestRunner, self).run(test)
         result.printLogs(test)
         return result
 
 
 class BaseMarionetteArguments(ArgumentParser):
-    socket_timeout_default = 65.0
+    socket_timeout_default = 60.0
 
     def __init__(self, **kwargs):
         ArgumentParser.__init__(self, **kwargs)
 
         def dir_path(path):
             path = os.path.abspath(os.path.expanduser(path))
             if not os.access(path, os.F_OK):
                 os.makedirs(path)
@@ -342,18 +342,17 @@ class BaseMarionetteArguments(ArgumentPa
                           default=False,
                           help='Enable the jsdebugger for marionette javascript.')
         self.add_argument('--pydebugger',
                           help='Enable python post-mortem debugger when a test fails.'
                                ' Pass in the debugger you want to use, eg pdb or ipdb.')
         self.add_argument('--socket-timeout',
                           type=float,
                           default=self.socket_timeout_default,
-                          help='Set the global timeout for marionette socket operations.'
-                               ' Default: %(default)ss.')
+                          help='Set the global timeout for marionette socket operations.')
         self.add_argument('--disable-e10s',
                           action='store_false',
                           dest='e10s',
                           default=True,
                           help='Disable e10s when running marionette tests.')
         self.add_argument('--tag',
                           action='append', dest='test_tags',
                           default=None,
--- a/testing/marionette/harness/marionette_harness/tests/unit/test_capabilities.py
+++ b/testing/marionette/harness/marionette_harness/tests/unit/test_capabilities.py
@@ -6,24 +6,17 @@ from marionette_driver.errors import Ses
 
 from marionette_harness import MarionetteTestCase
 
 
 class TestCapabilities(MarionetteTestCase):
 
     def setUp(self):
         super(TestCapabilities, self).setUp()
-
-        # Force default webdriver capabilities by default to test
-        # Marionette server.
-        self.marionette.delete_session()
-        self.marionette.start_session({"desiredCapabilities": {}})
-
         self.caps = self.marionette.session_capabilities
-
         with self.marionette.using_context("chrome"):
             self.appinfo = self.marionette.execute_script(
                 "return Services.appinfo")
             self.os_name = self.marionette.execute_script(
                 "return Services.sysinfo.getProperty('name')").lower()
             self.os_version = self.marionette.execute_script(
                 "return Services.sysinfo.getProperty('version')")
 
@@ -35,18 +28,20 @@ class TestCapabilities(MarionetteTestCas
         self.assertIn("acceptInsecureCerts", self.caps)
         self.assertIn("timeouts", self.caps)
 
         self.assertEqual(self.caps["browserName"], self.appinfo["name"].lower())
         self.assertEqual(self.caps["browserVersion"], self.appinfo["version"])
         self.assertEqual(self.caps["platformName"], self.os_name)
         self.assertEqual(self.caps["platformVersion"], self.os_version)
         self.assertFalse(self.caps["acceptInsecureCerts"])
-        self.assertEqual(self.caps["timeouts"],
-                         {"implicit": 0, "page load": 300000, "script": 30000})
+        self.assertDictEqual(self.caps["timeouts"],
+                             {"implicit": 0,
+                              "page load": 300000,
+                              "script": 30000})
 
     def test_supported_features(self):
         self.assertIn("rotatable", self.caps)
 
     def test_additional_capabilities(self):
         self.assertIn("moz:processID", self.caps)
         self.assertEqual(self.caps["moz:processID"], self.appinfo["processID"])
         self.assertEqual(self.marionette.process_id, self.appinfo["processID"])
@@ -60,24 +55,16 @@ class TestCapabilities(MarionetteTestCas
             self.assertEqual(self.caps["moz:profile"], current_profile)
             self.assertEqual(self.marionette.profile, current_profile)
 
         self.assertIn("moz:accessibilityChecks", self.caps)
         self.assertFalse(self.caps["moz:accessibilityChecks"])
         self.assertIn("specificationLevel", self.caps)
         self.assertEqual(self.caps["specificationLevel"], 0)
 
-    def test_default_client_capabilities(self):
-        self.marionette.delete_session()
-        self.marionette.start_session()
-        caps = self.marionette.session_capabilities
-
-        self.assertEqual(caps["timeouts"],
-                         {"implicit": 0, "page load": 60000, "script": 30000})
-
     def test_set_specification_level(self):
         self.marionette.delete_session()
         self.marionette.start_session({"desiredCapabilities": {"specificationLevel": 2}})
         caps = self.marionette.session_capabilities
         self.assertEqual(2, caps["specificationLevel"])
 
         self.marionette.delete_session()
         self.marionette.start_session({"requiredCapabilities": {"specificationLevel": 3}})
@@ -130,104 +117,97 @@ class TestCapabilityMatching(MarionetteT
     def test_browser_name_required(self):
         self.marionette.start_session({"requiredCapabilities": {"browserName": self.browser_name}})
         self.assertEqual(self.marionette.session_capabilities["browserName"], self.browser_name)
 
     def test_browser_name_desired_allowed_types(self):
         for typ in self.allowed:
             self.marionette.delete_session()
             self.marionette.start_session({"desiredCapabilities": {"browserName": typ}})
-            self.assertEqual(self.marionette.session_capabilities["browserName"],
-                             self.browser_name)
+            self.assertEqual(self.marionette.session_capabilities["browserName"], self.browser_name)
 
     def test_browser_name_desired_disallowed_types(self):
         for typ in self.disallowed:
             with self.assertRaises(SessionNotCreatedException):
                 self.marionette.start_session({"desiredCapabilities": {"browserName": typ}})
 
     def test_browser_name_required_allowed_types(self):
         for typ in self.allowed:
             self.marionette.delete_session()
             self.marionette.start_session({"requiredCapabilities": {"browserName": typ}})
-            self.assertEqual(self.marionette.session_capabilities["browserName"],
-                             self.browser_name)
+            self.assertEqual(self.marionette.session_capabilities["browserName"], self.browser_name)
 
     def test_browser_name_requried_disallowed_types(self):
         for typ in self.disallowed:
             with self.assertRaises(SessionNotCreatedException):
                 self.marionette.start_session({"requiredCapabilities": {"browserName": typ}})
 
     def test_browser_name_prefers_required(self):
         caps = {"desiredCapabilities": {"browserName": "invalid"},
-                "requiredCapabilities": {"browserName": "*"}}
+                    "requiredCapabilities": {"browserName": "*"}}
         self.marionette.start_session(caps)
 
     def test_browser_name_error_on_invalid_required(self):
         with self.assertRaises(SessionNotCreatedException):
             caps = {"desiredCapabilities": {"browserName": "*"},
-                    "requiredCapabilities": {"browserName": "invalid"}}
+                        "requiredCapabilities": {"browserName": "invalid"}}
             self.marionette.start_session(caps)
 
     # TODO(ato): browser version comparison not implemented yet
 
     def test_platform_name_desired(self):
-        self.marionette.start_session(
-            {"desiredCapabilities": {"platformName": self.platform_name}})
+        self.marionette.start_session({"desiredCapabilities": {"platformName": self.platform_name}})
         self.assertEqual(self.marionette.session_capabilities["platformName"], self.platform_name)
 
     def test_platform_name_required(self):
-        self.marionette.start_session(
-            {"requiredCapabilities": {"platformName": self.platform_name}})
+        self.marionette.start_session({"requiredCapabilities": {"platformName": self.platform_name}})
         self.assertEqual(self.marionette.session_capabilities["platformName"], self.platform_name)
 
     def test_platform_name_desired_allowed_types(self):
         for typ in self.allowed:
             self.marionette.delete_session()
             self.marionette.start_session({"desiredCapabilities": {"platformName": typ}})
-            self.assertEqual(self.marionette.session_capabilities["platformName"],
-                             self.platform_name)
+            self.assertEqual(self.marionette.session_capabilities["platformName"], self.platform_name)
 
     def test_platform_name_desired_disallowed_types(self):
         for typ in self.disallowed:
             with self.assertRaises(SessionNotCreatedException):
                 self.marionette.start_session({"desiredCapabilities": {"platformName": typ}})
 
     def test_platform_name_required_allowed_types(self):
         for typ in self.allowed:
             self.marionette.delete_session()
             self.marionette.start_session({"requiredCapabilities": {"platformName": typ}})
-            self.assertEqual(self.marionette.session_capabilities["platformName"],
-                             self.platform_name)
+            self.assertEqual(self.marionette.session_capabilities["platformName"], self.platform_name)
 
     def test_platform_name_requried_disallowed_types(self):
         for typ in self.disallowed:
             with self.assertRaises(SessionNotCreatedException):
                 self.marionette.start_session({"requiredCapabilities": {"platformName": typ}})
 
     def test_platform_name_prefers_required(self):
         caps = {"desiredCapabilities": {"platformName": "invalid"},
-                "requiredCapabilities": {"platformName": "*"}}
+                    "requiredCapabilities": {"platformName": "*"}}
         self.marionette.start_session(caps)
 
     def test_platform_name_error_on_invalid_required(self):
         with self.assertRaises(SessionNotCreatedException):
             caps = {"desiredCapabilities": {"platformName": "*"},
-                    "requiredCapabilities": {"platformName": "invalid"}}
+                        "requiredCapabilities": {"platformName": "invalid"}}
             self.marionette.start_session(caps)
 
     # TODO(ato): platform version comparison not imlpemented yet
 
     def test_accept_insecure_certs(self):
         for capability_type in ["desiredCapabilities", "requiredCapabilities"]:
             print("testing {}".format(capability_type))
             for value in ["", 42, {}, []]:
                 print("  type {}".format(type(value)))
                 with self.assertRaises(SessionNotCreatedException):
-                    self.marionette.start_session(
-                        {capability_type: {"acceptInsecureCerts": value}})
+                    self.marionette.start_session({capability_type: {"acceptInsecureCerts": value}})
 
         self.marionette.delete_session()
         self.marionette.start_session({"desiredCapabilities": {"acceptInsecureCerts": True}})
         self.assertTrue(self.marionette.session_capabilities["acceptInsecureCerts"])
         self.marionette.delete_session()
         self.marionette.start_session({"requiredCapabilities": {"acceptInsecureCerts": True}})
 
         self.assertTrue(self.marionette.session_capabilities["acceptInsecureCerts"])
@@ -256,14 +236,14 @@ class TestCapabilityMatching(MarionetteT
 
     def test_proxy_required(self):
         self.marionette.start_session({"requiredCapabilities": {"proxy": {"proxyType": "manual"}}})
         self.assertIn("proxy", self.marionette.session_capabilities)
         self.assertEqual(self.marionette.session_capabilities["proxy"]["proxyType"], "manual")
         self.assertEqual(self.marionette.get_pref("network.proxy.type"), 1)
 
     def test_timeouts(self):
-        timeouts = {"implicit": 123, "page load": 456, "script": 789}
+        timeouts = {u"implicit": 123, u"page load": 456, u"script": 789}
         caps = {"desiredCapabilities": {"timeouts": timeouts}}
         self.marionette.start_session(caps)
         self.assertIn("timeouts", self.marionette.session_capabilities)
-        self.assertEqual(self.marionette.session_capabilities["timeouts"], timeouts)
-        self.assertEqual(self.marionette._send_message("getTimeouts"), timeouts)
+        self.assertDictEqual(self.marionette.session_capabilities["timeouts"], timeouts)
+        self.assertDictEqual(self.marionette._send_message("getTimeouts"), timeouts)