forked from mirrors/gecko-dev
Bug 937659 - Fix deserializing of page load strategy. r=ato
The patch aligns the steps for deserializing the page load strategy with the webdriver specification. MozReview-Commit-ID: GnVTnhVQVkG --HG-- extra : rebase_source : c7796817fa6d0397b4821445dc3bd87853e0e509
This commit is contained in:
parent
b777047482
commit
cfdbf9979c
2 changed files with 17 additions and 5 deletions
|
|
@ -223,9 +223,14 @@ class TestCapabilityMatching(MarionetteTestCase):
|
||||||
self.marionette.start_session({"desiredCapabilities": {"pageLoadStrategy": strategy}})
|
self.marionette.start_session({"desiredCapabilities": {"pageLoadStrategy": strategy}})
|
||||||
self.assertEqual(self.marionette.session_capabilities["pageLoadStrategy"], strategy)
|
self.assertEqual(self.marionette.session_capabilities["pageLoadStrategy"], strategy)
|
||||||
|
|
||||||
|
# A null value should be treatend as "normal"
|
||||||
|
self.delete_session()
|
||||||
|
self.marionette.start_session({"desiredCapabilities": {"pageLoadStrategy": None}})
|
||||||
|
self.assertEqual(self.marionette.session_capabilities["pageLoadStrategy"], "normal")
|
||||||
|
|
||||||
for value in ["", "EAGER", True, 42, {}, []]:
|
for value in ["", "EAGER", True, 42, {}, []]:
|
||||||
print("invalid strategy {}".format(value))
|
print("invalid strategy {}".format(value))
|
||||||
with self.assertRaises(SessionNotCreatedException):
|
with self.assertRaisesRegexp(SessionNotCreatedException, "InvalidArgumentError"):
|
||||||
self.marionette.start_session({"desiredCapabilities": {"pageLoadStrategy": value}})
|
self.marionette.start_session({"desiredCapabilities": {"pageLoadStrategy": value}})
|
||||||
|
|
||||||
def test_proxy_default(self):
|
def test_proxy_default(self):
|
||||||
|
|
|
||||||
|
|
@ -245,7 +245,7 @@ session.Capabilities = class extends Map {
|
||||||
throw new TypeError();
|
throw new TypeError();
|
||||||
}
|
}
|
||||||
|
|
||||||
return super.set(key, value);
|
return super.set(key, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
toString() { return "[object session.Capabilities]"; }
|
toString() { return "[object session.Capabilities]"; }
|
||||||
|
|
@ -357,11 +357,18 @@ session.Capabilities = class extends Map {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "pageLoadStrategy":
|
case "pageLoadStrategy":
|
||||||
if (Object.values(session.PageLoadStrategy).includes(v)) {
|
if (v === null) {
|
||||||
matched.set("pageLoadStrategy", v);
|
matched.set("pageLoadStrategy", session.PageLoadStrategy.Normal);
|
||||||
} else {
|
} else {
|
||||||
throw new TypeError("Unknown page load strategy: " + v);
|
assert.string(v);
|
||||||
|
|
||||||
|
if (Object.values(session.PageLoadStrategy).includes(v)) {
|
||||||
|
matched.set("pageLoadStrategy", v);
|
||||||
|
} else {
|
||||||
|
throw new InvalidArgumentError("Unknown page load strategy: " + v);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "proxy":
|
case "proxy":
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue