зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1369827
- Fix socksVersion key in proxy capabilities. r=ato
In the spec the socksProxyVersion key has been renamed to socksVersion. Marionette has to be adjusted for this change. MozReview-Commit-ID: Ep3zNZLKxXl --HG-- extra : rebase_source : f29f45c9d30fa5f208b595f2e90f544ab652c8cc
This commit is contained in:
Родитель
8c9c9c7b11
Коммит
636959a3aa
|
@ -58,6 +58,26 @@ class TestProxyCapabilities(MarionetteTestCase):
|
||||||
"ftpProxy": "{}:21".format(proxy_hostname),
|
"ftpProxy": "{}:21".format(proxy_hostname),
|
||||||
"httpProxy": "{}:80".format(proxy_hostname),
|
"httpProxy": "{}:80".format(proxy_hostname),
|
||||||
"sslProxy": "{}:443".format(proxy_hostname),
|
"sslProxy": "{}:443".format(proxy_hostname),
|
||||||
|
"socksProxy": proxy_hostname,
|
||||||
|
"socksVersion": 4,
|
||||||
|
}}
|
||||||
|
|
||||||
|
self.marionette.start_session(capabilities)
|
||||||
|
self.assertEqual(self.marionette.session_capabilities["proxy"],
|
||||||
|
capabilities["proxy"])
|
||||||
|
|
||||||
|
def test_proxy_type_manual_socks_requires_version(self):
|
||||||
|
proxy_port = 4444
|
||||||
|
proxy_hostname = "marionette.test"
|
||||||
|
proxy_host = "{}:{}".format(proxy_hostname, proxy_port)
|
||||||
|
capabilities = {"proxy": {
|
||||||
|
"proxyType": "manual",
|
||||||
|
"socksProxy": proxy_host,
|
||||||
|
}}
|
||||||
|
|
||||||
|
with self.assertRaises(errors.SessionNotCreatedException):
|
||||||
|
self.marionette.start_session(capabilities)
|
||||||
|
|
||||||
def test_proxy_type_pac(self):
|
def test_proxy_type_pac(self):
|
||||||
pac_url = "http://marionette.test"
|
pac_url = "http://marionette.test"
|
||||||
capabilities = {"proxy": {"proxyType": "pac", "proxyAutoconfigUrl": pac_url}}
|
capabilities = {"proxy": {"proxyType": "pac", "proxyAutoconfigUrl": pac_url}}
|
||||||
|
@ -96,3 +116,9 @@ class TestProxyCapabilities(MarionetteTestCase):
|
||||||
with self.assertRaises(errors.SessionNotCreatedException):
|
with self.assertRaises(errors.SessionNotCreatedException):
|
||||||
self.marionette.start_session({"proxy": {"proxyType": "pac",
|
self.marionette.start_session({"proxy": {"proxyType": "pac",
|
||||||
"proxyAutoconfigUrl": None}})
|
"proxyAutoconfigUrl": None}})
|
||||||
|
|
||||||
|
def test_missing_socks_version_for_manual(self):
|
||||||
|
capabilities = {"proxy": {"proxyType": "manual", "socksProxy": "marionette.test"}}
|
||||||
|
|
||||||
|
with self.assertRaises(errors.SessionNotCreatedException):
|
||||||
|
self.marionette.start_session(capabilities)
|
||||||
|
|
|
@ -276,8 +276,7 @@ session.Proxy = class {
|
||||||
}
|
}
|
||||||
if (typeof json.socksProxy != "undefined") {
|
if (typeof json.socksProxy != "undefined") {
|
||||||
[p.socksProxy, p.socksProxyPort] = fromHost("socks", json.socksProxy);
|
[p.socksProxy, p.socksProxyPort] = fromHost("socks", json.socksProxy);
|
||||||
p.socksProxyVersion = assert.positiveInteger(
|
p.socksVersion = assert.positiveInteger(json.socksVersion);
|
||||||
json.socksProxyVersion);
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -312,7 +311,7 @@ session.Proxy = class {
|
||||||
httpProxy: toHost(this.httpProxy, this.httpProxyPort),
|
httpProxy: toHost(this.httpProxy, this.httpProxyPort),
|
||||||
sslProxy: toHost(this.sslProxy, this.sslProxyPort),
|
sslProxy: toHost(this.sslProxy, this.sslProxyPort),
|
||||||
socksProxy: toHost(this.socksProxy, this.socksProxyPort),
|
socksProxy: toHost(this.socksProxy, this.socksProxyPort),
|
||||||
socksProxyVersion: this.socksProxyVersion,
|
socksVersion: this.socksVersion,
|
||||||
proxyAutoconfigUrl: this.proxyAutoconfigUrl,
|
proxyAutoconfigUrl: this.proxyAutoconfigUrl,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -189,6 +189,11 @@ add_test(function test_Proxy_toJSON() {
|
||||||
let manual = new session.Proxy();
|
let manual = new session.Proxy();
|
||||||
manual.proxyType = "manual";
|
manual.proxyType = "manual";
|
||||||
|
|
||||||
|
if (proxy == "socksProxy") {
|
||||||
|
manual.socksVersion = 5;
|
||||||
|
expected.socksVersion = 5;
|
||||||
|
}
|
||||||
|
|
||||||
// without port
|
// without port
|
||||||
manual[proxy] = "foo";
|
manual[proxy] = "foo";
|
||||||
expected[proxy] = "foo"
|
expected[proxy] = "foo"
|
||||||
|
@ -238,8 +243,8 @@ add_test(function test_Proxy_fromJSON() {
|
||||||
|
|
||||||
let expected = {"proxyType": "manual"};
|
let expected = {"proxyType": "manual"};
|
||||||
if (proxy == "socksProxy") {
|
if (proxy == "socksProxy") {
|
||||||
manual.socksProxyVersion = 5;
|
manual.socksVersion = 5;
|
||||||
expected.socksProxyVersion = 5;
|
expected.socksVersion = 5;
|
||||||
}
|
}
|
||||||
|
|
||||||
// valid proxy hosts with port
|
// valid proxy hosts with port
|
||||||
|
|
Загрузка…
Ссылка в новой задаче