geckodriver: marionette: add Get Timeouts command

Source-Repo: https://github.com/mozilla/geckodriver
Source-Revision: 140ab5a897d16d01418fc8aff94ae580eef49f2d

--HG--
extra : rebase_source : ca327ed76cfc819270598648c0b85e949c3bbd57
This commit is contained in:
Andreas Tolfsen 2017-02-24 17:44:11 +00:00
Родитель 761fb7defd
Коммит 55c366fde3
2 изменённых файлов: 37 добавлений и 6 удалений

Просмотреть файл

@ -4,9 +4,15 @@ All notable changes to this program is documented in this file.
## Unreleased
### Added
- Added routing and parsing for the [Get Timeouts](https://w3c.github.io/webdriver/webdriver-spec.html#dfn-get-timeouts) command
### Changed
- Now uses about:blank as the new tab document; this was previously disabled due to [bug 1333736](https://bugzilla.mozilla.org/show_bug.cgi?id=1333736) in Marionette
### Fixed
- Aligned the data structure accepted by the [Set Timeouts](https://w3c.github.io/webdriver/webdriver-spec.html#set-timeouts) command with the WebDriver specification
## 0.14.0 (2017-01-31)
### Changed

Просмотреть файл

@ -40,9 +40,9 @@ use webdriver::command::{
SwitchToFrameParameters, LocatorParameters, JavascriptCommandParameters,
GetNamedCookieParameters, AddCookieParameters, TimeoutsParameters,
ActionsParameters, TakeScreenshotParameters, WindowPositionParameters};
use webdriver::response::{
WebDriverResponse, NewSessionResponse, ValueResponse, WindowSizeResponse,
WindowPositionResponse, ElementRectResponse, CookieResponse, Cookie};
use webdriver::response::{Cookie, CookieResponse, ElementRectResponse, NewSessionResponse,
TimeoutsResponse, ValueResponse, WebDriverResponse,
WindowPositionResponse, WindowSizeResponse};
use webdriver::common::{
Date, Nullable, WebElement, FrameId, ELEMENT_KEY};
use webdriver::error::{ErrorStatus, WebDriverError, WebDriverResult};
@ -532,8 +532,33 @@ impl MarionetteSession {
WebDriverResponse::Generic(ValueResponse::new(value.clone()))
},
GetTimeouts => {
return Err(WebDriverError::new(ErrorStatus::UnsupportedOperation,
"Getting timeouts not yet supported"));
let script = try_opt!(try_opt!(resp.result
.find("script"),
ErrorStatus::UnknownError,
"Missing field: script")
.as_u64(),
ErrorStatus::UnknownError,
"Failed to interpret script timeout duration as u64");
let page_load = try_opt!(try_opt!(resp.result
.find("pageLoad"),
ErrorStatus::UnknownError,
"Missing field: pageLoad")
.as_u64(),
ErrorStatus::UnknownError,
"Failed to interpret page load duration as u64");
let implicit = try_opt!(try_opt!(resp.result
.find("implicit"),
ErrorStatus::UnknownError,
"Missing field: implicit")
.as_u64(),
ErrorStatus::UnknownError,
"Failed to interpret implicit search duration as u64");
WebDriverResponse::Timeouts(TimeoutsResponse {
script: script,
pageLoad: page_load,
implicit: implicit,
})
},
Status => panic!("Got status command that should already have been handled"),
GetWindowHandles => {
@ -810,7 +835,7 @@ impl MarionetteCommand {
GetWindowHandle => (Some("getWindowHandle"), None),
GetWindowHandles => (Some("getWindowHandles"), None),
CloseWindow => (Some("close"), None),
GetTimeouts => (None, None),
GetTimeouts => (Some("getTimeouts"), None),
SetTimeouts(ref x) => (Some("timeouts"), Some(x.to_marionette())),
SetWindowSize(ref x) => (Some("setWindowSize"), Some(x.to_marionette())),
GetWindowSize => (Some("getWindowSize"), None),