Bug 1391016 - Make sure that proxyType is required and a string.
The webdriver spec declares the "proxyType" as required, and of
type string.
MozReview-Commit-ID: FXUhdYfOwWI
--- a/testing/marionette/harness/marionette_harness/tests/unit/test_capabilities.py
+++ b/testing/marionette/harness/marionette_harness/tests/unit/test_capabilities.py
@@ -118,16 +118,23 @@ class TestCapabilityMatching(MarionetteT
print("invalid strategy {}".format(value))
with self.assertRaisesRegexp(SessionNotCreatedException, "InvalidArgumentError"):
self.marionette.start_session({"pageLoadStrategy": value})
def test_proxy_none_by_default(self):
self.marionette.start_session()
self.assertNotIn("proxy", self.marionette.session_capabilities)
+ def test_invalid_proxy_type(self):
+ with self.assertRaises(SessionNotCreatedException):
+ self.marionette.start_session({"proxy": {"proxyAutoconfigUrl": None}})
+
+ with self.assertRaises(SessionNotCreatedException):
+ self.marionette.start_session({"proxy": {"proxyType": None}})
+
def test_proxy_type_direct(self):
self.marionette.start_session({"proxy": {"proxyType": "direct"}})
self.assertIn("proxy", self.marionette.session_capabilities)
self.assertEqual(self.marionette.session_capabilities["proxy"]["proxyType"], "direct")
self.assertEqual(self.marionette.get_pref("network.proxy.type"), 0)
def test_proxy_type_manual(self):
self.marionette.start_session({"proxy": {"proxyType": "manual"}})
--- a/testing/marionette/session.js
+++ b/testing/marionette/session.js
@@ -206,17 +206,17 @@ session.Proxy = class {
let p = new session.Proxy();
if (typeof json == "undefined" || json === null) {
return p;
}
assert.object(json);
assert.in("proxyType", json);
- p.proxyType = json.proxyType;
+ p.proxyType = assert.string(json.proxyType);
if (json.proxyType == "manual") {
if (typeof json.httpProxy != "undefined") {
p.httpProxy = assert.string(json.httpProxy);
p.httpProxyPort = assert.positiveInteger(json.httpProxyPort);
}
if (typeof json.sslProxy != "undefined") {