Bug 1288863: Return platformName and browserVersion as lowercase r=ato, a=test-only
authorDavid Burns <dburns@mozilla.com>
Tue, 26 Jul 2016 10:13:35 +0100
changeset 342232 fb620cf5aae2276dc58c7b1cca45395b8a18ff67
parent 342231 38ea759f23056c0bf1d506bbe085279205c06717
child 342233 6106148d2caa25c93134c88d20f00c4a62e91715
push id1183
push userraliiev@mozilla.com
push dateMon, 05 Sep 2016 20:01:49 +0000
treeherdermozilla-release@3148731bed45 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersato, test-only
bugs1288863
milestone49.0
Bug 1288863: Return platformName and browserVersion as lowercase r=ato, a=test-only Currently Marionette returns directly from appInfo where the webdriver specification mandates that we return lowercase for those. See http://w3c.github.io/webdriver/webdriver-spec.html#capabilities MozReview-Commit-ID: 4UrOcYRuREK
testing/marionette/driver.js
testing/marionette/harness/marionette/tests/unit/test_about_pages.py
testing/marionette/harness/marionette/tests/unit/test_capabilities.py
testing/marionette/harness/marionette/tests/unit/test_key_actions.py
testing/marionette/harness/marionette/tests/unit/test_mouse_action.py
testing/marionette/harness/marionette/tests/unit/test_typing.py
testing/marionette/harness/marionette/tests/unit/test_window_handles.py
testing/marionette/listener.js
--- a/testing/marionette/driver.js
+++ b/testing/marionette/driver.js
@@ -125,19 +125,19 @@ this.GeckoDriver = function(appName, dev
   // frame ID of the current remote frame, used for mozbrowserclose events
   this.oopFrameId = null;
   this.observing = null;
   this._browserIds = new WeakMap();
   this.actions = new action.Chain();
 
   this.sessionCapabilities = {
     // mandated capabilities
-    "browserName": Services.appinfo.name,
+    "browserName": Services.appinfo.name.toLowerCase(),
     "browserVersion": Services.appinfo.version,
-    "platformName": Services.sysinfo.getProperty("name"),
+    "platformName": Services.sysinfo.getProperty("name").toLowerCase(),
     "platformVersion": Services.sysinfo.getProperty("version"),
     "specificationLevel": 0,
 
     // supported features
     "raisesAccessibilityExceptions": false,
     "rotatable": this.appName == "B2G",
     "acceptSslCerts": false,
     "takesElementScreenshot": true,
--- a/testing/marionette/harness/marionette/tests/unit/test_about_pages.py
+++ b/testing/marionette/harness/marionette/tests/unit/test_about_pages.py
@@ -7,17 +7,17 @@ from marionette.marionette_test import s
 from marionette_driver.keys import Keys
 from marionette_driver.by import By
 
 
 class TestAboutPages(MarionetteTestCase):
 
     def setUp(self):
         MarionetteTestCase.setUp(self)
-        if self.marionette.session_capabilities['platformName'] == 'Darwin':
+        if self.marionette.session_capabilities['platformName'] == 'darwin':
             self.mod_key = Keys.META
         else:
             self.mod_key = Keys.CONTROL
 
         self.remote_uri = self.marionette.absolute_url("javascriptPage.html")
         self.marionette.navigate(self.remote_uri)
 
     def test_back_forward(self):
--- a/testing/marionette/harness/marionette/tests/unit/test_capabilities.py
+++ b/testing/marionette/harness/marionette/tests/unit/test_capabilities.py
@@ -10,32 +10,32 @@ class TestCapabilities(MarionetteTestCas
 
     def setUp(self):
         super(TestCapabilities, self).setUp()
         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')")
+                "return Services.sysinfo.getProperty('name')").lower()
             self.os_version = self.marionette.execute_script(
                 "return Services.sysinfo.getProperty('version')")
 
     @property
     def is_b2g(self):
         return self.appinfo["name"] == "B2G"
 
     def test_mandates_capabilities(self):
         self.assertIn("browserName", self.caps)
         self.assertIn("browserVersion", self.caps)
         self.assertIn("platformName", self.caps)
         self.assertIn("platformVersion", self.caps)
         self.assertIn("specificationLevel", self.caps)
 
-        self.assertEqual(self.caps["browserName"], self.appinfo["name"])
+        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.assertEqual(self.caps["specificationLevel"], 0)
 
     def test_supported_features(self):
         self.assertIn("rotatable", self.caps)
         self.assertIn("acceptSslCerts", self.caps)
@@ -74,22 +74,22 @@ class TestCapabilities(MarionetteTestCas
         caps = self.marionette.session_capabilities
         self.assertEqual(1, caps["specificationLevel"])
 
     def test_we_dont_overwrite_server_capabilities(self):
         self.marionette.delete_session()
         capabilities = {"desiredCapabilities": {"browserName": "ChocolateCake"}}
         self.marionette.start_session(capabilities)
         caps = self.marionette.session_capabilities
-        self.assertEqual(caps["browserName"], self.appinfo["name"],
-                         "This should have appname not ChocolateCake")
+        self.assertEqual(caps["browserName"], self.appinfo["name"].lower(),
+                         "This should have appname not ChocolateCake.")
 
     def test_we_can_pass_in_required_capabilities_on_session_start(self):
         self.marionette.delete_session()
-        capabilities = {"requiredCapabilities": {"browserName": self.appinfo["name"]}}
+        capabilities = {"requiredCapabilities": {"browserName": self.appinfo["name"].lower()}}
         self.marionette.start_session(capabilities)
         caps = self.marionette.session_capabilities
         self.assertIn("browserName", caps)
 
     def test_we_pass_in_required_capability_we_cant_fulfil_raises_exception(self):
         self.marionette.delete_session()
         capabilities = {"requiredCapabilities": {"browserName": "CookiesAndCream"}}
         try:
--- a/testing/marionette/harness/marionette/tests/unit/test_key_actions.py
+++ b/testing/marionette/harness/marionette/tests/unit/test_key_actions.py
@@ -6,17 +6,17 @@ from marionette import MarionetteTestCas
 from marionette_driver.keys import Keys
 from marionette_driver.marionette import Actions
 from marionette_driver.by import By
 
 
 class TestKeyActions(MarionetteTestCase):
     def setUp(self):
         MarionetteTestCase.setUp(self)
-        if self.marionette.session_capabilities["platformName"] == "Darwin":
+        if self.marionette.session_capabilities["platformName"] == "darwin":
             self.mod_key = Keys.META
         else:
             self.mod_key = Keys.CONTROL
         test_html = self.marionette.absolute_url("javascriptPage.html")
         self.marionette.navigate(test_html)
         self.reporter_element = self.marionette.find_element(By.ID, "keyReporter")
         self.reporter_element.click()
         self.key_action = Actions(self.marionette)
--- a/testing/marionette/harness/marionette/tests/unit/test_mouse_action.py
+++ b/testing/marionette/harness/marionette/tests/unit/test_mouse_action.py
@@ -6,17 +6,17 @@ from marionette import MarionetteTestCas
 from marionette_driver.marionette import Actions
 from marionette_driver.keys import Keys
 from marionette_driver.by import By
 
 
 class TestMouseAction(MarionetteTestCase):
     def setUp(self):
         MarionetteTestCase.setUp(self)
-        if self.marionette.session_capabilities["platformName"] == "Darwin":
+        if self.marionette.session_capabilities["platformName"] == "darwin":
             self.mod_key = Keys.META
         else:
             self.mod_key = Keys.CONTROL
         self.action = Actions(self.marionette)
 
     def test_click_action(self):
         test_html = self.marionette.absolute_url("test.html")
         self.marionette.navigate(test_html)
--- a/testing/marionette/harness/marionette/tests/unit/test_typing.py
+++ b/testing/marionette/harness/marionette/tests/unit/test_typing.py
@@ -53,17 +53,17 @@ class TestTyping(MarionetteTestCase):
         self.marionette.navigate(test_html)
 
         keyReporter = self.marionette.find_element(By.ID, "keyReporter")
         keyReporter.send_keys("ABC DEF")
         self.assertEqual("ABC DEF", keyReporter.get_property("value"))
 
     def testCutAndPasteShortcuts(self):
         # test that modifier keys work via copy/paste shortcuts
-        if self.marionette.session_capabilities["platformName"] == "Darwin":
+        if self.marionette.session_capabilities["platformName"] == "darwin":
             mod_key = Keys.META
         else:
             mod_key = Keys.CONTROL
 
         test_html = self.marionette.absolute_url("javascriptPage.html")
         self.marionette.navigate(test_html)
 
         keyReporter = self.marionette.find_element(By.ID, "keyReporter")
--- a/testing/marionette/harness/marionette/tests/unit/test_window_handles.py
+++ b/testing/marionette/harness/marionette/tests/unit/test_window_handles.py
@@ -7,17 +7,17 @@ from marionette_driver.keys import Keys
 from marionette_driver.by import By
 
 
 class TestWindowHandles(MarionetteTestCase):
 
     def test_new_tab_window_handles(self):
 
         keys = []
-        if self.marionette.session_capabilities['platformName'] == 'Darwin':
+        if self.marionette.session_capabilities['platformName'] == 'darwin':
             keys.append(Keys.META)
         else:
             keys.append(Keys.CONTROL)
         keys.append('t')
 
         origin_win = self.marionette.current_window_handle
 
         with self.marionette.using_context("chrome"):
--- a/testing/marionette/listener.js
+++ b/testing/marionette/listener.js
@@ -119,17 +119,17 @@ var sandboxName = "default";
 function registerSelf() {
   let msg = {value: winUtil.outerWindowID};
   // register will have the ID and a boolean describing if this is the main process or not
   let register = sendSyncMessage("Marionette:register", msg);
 
   if (register[0]) {
     let {id, remotenessChange} = register[0][0];
     capabilities = register[0][2];
-    isB2G = capabilities.platformName == "B2G";
+    isB2G = capabilities.platformName == "b2g";
     listenerId = id;
     if (typeof id != "undefined") {
       // check if we're the main process
       if (register[0][1] == true) {
         addMessageListener("MarionetteMainListener:emitTouchEvent", emitTouchEventForIFrame);
       }
       startListeners();
       let rv = {};