Skip to content

Commit

Permalink
Bug 1288863: Return platformName and browserVersion as lowercase r=ato
Browse files Browse the repository at this point in the history
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

--HG--
extra : rebase_source : b47a4be6f4eb17e3bf9caf8542cc2f03582df946
  • Loading branch information
David Burns committed Jul 26, 2016
1 parent 6b13b3c commit 8ae5a3c
Show file tree
Hide file tree
Showing 8 changed files with 13 additions and 13 deletions.
4 changes: 2 additions & 2 deletions testing/marionette/driver.js
Expand Up @@ -128,9 +128,9 @@ this.GeckoDriver = function(appName, stopSignal) {

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,

Expand Down
Expand Up @@ -12,7 +12,7 @@ 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
Expand Down
Expand Up @@ -15,7 +15,7 @@ def setUp(self):
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')")

Expand All @@ -30,7 +30,7 @@ def test_mandates_capabilities(self):
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)
Expand Down Expand Up @@ -78,12 +78,12 @@ def test_we_dont_overwrite_server_capabilities(self):
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)
Expand Down
Expand Up @@ -11,7 +11,7 @@
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
Expand Down
Expand Up @@ -11,7 +11,7 @@
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
Expand Down
Expand Up @@ -58,7 +58,7 @@ def testShouldBeAbleToTypeCapitalLetters(self):

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
Expand Down
Expand Up @@ -12,7 +12,7 @@ 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)
Expand Down
2 changes: 1 addition & 1 deletion testing/marionette/listener.js
Expand Up @@ -126,7 +126,7 @@ function registerSelf() {
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
Expand Down

0 comments on commit 8ae5a3c

Please sign in to comment.