mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 964367 - Fix incorrect format on platformName capability. r=mdas
The platformName capability (which AFAICT isn't checked in use by any dependants) should be a limited subset of prescribed platforms as defined by the WebDriver specification. System.appinfo.OS returns the correct values, but not upper cased. Additionally this patch introduces some tests and documentation for the getSessionCapabilities function in Marionette and cleans up the capability list.
This commit is contained in:
parent
6e58ac959d
commit
d698dad175
@ -30,3 +30,54 @@ class TestSession(marionette_test.MarionetteTestCase):
|
||||
self.assertIn("rotatable", caps)
|
||||
self.assertIn("takesScreenshot", caps)
|
||||
self.assertIn("version", caps)
|
||||
|
||||
class TestCapabilities(marionette_test.MarionetteTestCase):
|
||||
def setUp(self):
|
||||
super(TestCapabilities, self).setUp()
|
||||
self.caps = self.marionette.session_capabilities
|
||||
self.marionette.set_context("chrome")
|
||||
self.appinfo = self.marionette.execute_script(
|
||||
"return Services.appinfo")
|
||||
|
||||
def test_mandates_capabilities(self):
|
||||
self.assertIn("browserName", self.caps)
|
||||
self.assertIn("platformName", self.caps)
|
||||
self.assertIn("platformVersion", self.caps)
|
||||
|
||||
self.assertEqual(self.caps["browserName"], self.appinfo["name"])
|
||||
self.assertEqual(self.caps["platformName"], self.appinfo["OS"].upper())
|
||||
self.assertEqual(self.caps["platformVersion"],
|
||||
self.appinfo["platformVersion"])
|
||||
|
||||
def test_supported_features(self):
|
||||
self.assertIn("cssSelectorsEnabled", self.caps)
|
||||
self.assertIn("handlesAlerts", self.caps)
|
||||
self.assertIn("javascriptEnabled", self.caps)
|
||||
self.assertIn("nativeEvents", self.caps)
|
||||
self.assertIn("rotatable", self.caps)
|
||||
self.assertIn("secureSsl", self.caps)
|
||||
self.assertIn("takesElementScreenshot", self.caps)
|
||||
self.assertIn("takesScreenshot", self.caps)
|
||||
|
||||
self.assertTrue(self.caps["cssSelectorsEnabled"])
|
||||
self.assertFalse(self.caps["handlesAlerts"])
|
||||
self.assertTrue(self.caps["javascriptEnabled"])
|
||||
self.assertFalse(self.caps["nativeEvents"])
|
||||
self.assertEqual(self.caps["rotatable"], self.appinfo["name"] == "B2G")
|
||||
self.assertFalse(self.caps["secureSsl"])
|
||||
self.assertTrue(self.caps["takesElementScreenshot"])
|
||||
self.assertTrue(self.caps["takesScreenshot"])
|
||||
|
||||
def test_selenium2_compat(self):
|
||||
self.assertIn("platform", self.caps)
|
||||
self.assertEqual(self.caps["platform"], self.caps["platformName"])
|
||||
|
||||
def test_extensions(self):
|
||||
self.assertIn("XULappId", self.caps)
|
||||
self.assertIn("appBuildId", self.caps)
|
||||
self.assertIn("device", self.caps)
|
||||
self.assertIn("version", self.caps)
|
||||
|
||||
self.assertEqual(self.caps["XULappId"], self.appinfo["ID"])
|
||||
self.assertEqual(self.caps["appBuildId"], self.appinfo["appBuildID"])
|
||||
self.assertEqual(self.caps["version"], self.appinfo["version"])
|
||||
|
@ -535,36 +535,56 @@ MarionetteServerConnection.prototype = {
|
||||
this.switchToGlobalMessageManager();
|
||||
},
|
||||
|
||||
getSessionCapabilities: function MDA_getSessionCapabilities(){
|
||||
/**
|
||||
* Send the current session's capabilities to the client.
|
||||
*
|
||||
* Capabilities informs the client of which WebDriver features are
|
||||
* supported by Firefox and Marionette. They are immutable for the
|
||||
* length of the session.
|
||||
*
|
||||
* The return value is an immutable map of string keys
|
||||
* ("capabilities") to values, which may be of types boolean,
|
||||
* numerical or string.
|
||||
*/
|
||||
getSessionCapabilities: function MDA_getSessionCapabilities() {
|
||||
this.command_id = this.getCommandId();
|
||||
|
||||
let rotatable = appName == "B2G" ? true : false;
|
||||
let isB2G = appName == "B2G";
|
||||
let platformName = Services.appinfo.OS.toUpperCase();
|
||||
|
||||
let value = {
|
||||
'appBuildId' : Services.appinfo.appBuildID,
|
||||
'XULappId' : Services.appinfo.ID,
|
||||
'cssSelectorsEnabled': true,
|
||||
'browserName': appName,
|
||||
'handlesAlerts': false,
|
||||
'javascriptEnabled': true,
|
||||
'nativeEvents': false,
|
||||
'platform': Services.appinfo.OS,
|
||||
'platformName': Services.appinfo.OS,
|
||||
'platformVersion': Services.appinfo.platformVersion,
|
||||
'secureSsl': false,
|
||||
'device': qemu == "1" ? "qemu" : (!device ? "desktop" : device),
|
||||
'rotatable': rotatable,
|
||||
'takesScreenshot': true,
|
||||
'takesElementScreenshot': true,
|
||||
'version': Services.appinfo.version
|
||||
let caps = {
|
||||
// Mandated capabilities
|
||||
"browserName": appName,
|
||||
"platformName": platformName,
|
||||
"platformVersion": Services.appinfo.platformVersion,
|
||||
|
||||
// Supported features
|
||||
"cssSelectorsEnabled": true,
|
||||
"handlesAlerts": false,
|
||||
"javascriptEnabled": true,
|
||||
"nativeEvents": false,
|
||||
"rotatable": isB2G,
|
||||
"secureSsl": false,
|
||||
"takesElementScreenshot": true,
|
||||
"takesScreenshot": true,
|
||||
|
||||
// Selenium 2 compat
|
||||
"platform": platformName,
|
||||
|
||||
// Proprietary extensions
|
||||
"XULappId" : Services.appinfo.ID,
|
||||
"appBuildId" : Services.appinfo.appBuildID,
|
||||
"device": qemu == "1" ? "qemu" : (!device ? "desktop" : device),
|
||||
"version": Services.appinfo.version
|
||||
};
|
||||
|
||||
// eideticker (bug 965297) and mochitest (bug 965304)
|
||||
// compatibility
|
||||
if (appName == "B2G")
|
||||
value.b2g = true;
|
||||
// compatibility. They only check for the presence of this
|
||||
// property and should so not be in caps if not on a B2G device.
|
||||
if (isB2G)
|
||||
caps.b2g = true;
|
||||
|
||||
this.sendResponse(value, this.command_id);
|
||||
this.sendResponse(caps, this.command_id);
|
||||
},
|
||||
|
||||
getStatus: function MDA_getStatus(){
|
||||
|
Loading…
Reference in New Issue
Block a user