Bug 1370510: Implement Fullscreen Window command r=jgraham

This implements the geckodriver support for the Fullscreen Window command.
The API was introduced in the webdriver crate in
https://github.com/mozilla/webdriver-rust/pull/100

MozReview-Commit-ID: 3eIuLmGWl2x

--HG--
extra : rebase_source : 55b38b1ff2850d44b79270194874e7418d34a907
This commit is contained in:
David Burns 2017-06-07 12:42:30 +01:00
Родитель 2923be5074
Коммит a7b15fe05b
3 изменённых файлов: 40 добавлений и 5 удалений

6
testing/geckodriver/Cargo.lock сгенерированный
Просмотреть файл

@ -17,7 +17,7 @@ dependencies = [
"slog-stdlog 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"slog-stream 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"uuid 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)",
"webdriver 0.25.2 (registry+https://github.com/rust-lang/crates.io-index)",
"webdriver 0.26.0 (registry+https://github.com/rust-lang/crates.io-index)",
"zip 0.1.19 (registry+https://github.com/rust-lang/crates.io-index)",
]
@ -636,7 +636,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "webdriver"
version = "0.25.2"
version = "0.26.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"backtrace 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
@ -763,7 +763,7 @@ dependencies = [
"checksum uuid 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)" = "78c590b5bd79ed10aad8fb75f078a59d8db445af6c743e55c4a53227fc01c13f"
"checksum vec_map 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "887b5b631c2ad01628bbbaa7dd4c869f80d3186688f8d0b6f58774fbe324988c"
"checksum void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d"
"checksum webdriver 0.25.2 (registry+https://github.com/rust-lang/crates.io-index)" = "0d161bc62ed766ddc0838af89f1b339ed3c8b5c3dbe8776b59731dfae7b1a6c7"
"checksum webdriver 0.26.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3099729d884692d690796454e8529edf3f0ebd87c87840f9c809df8eabb175ed"
"checksum winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a"
"checksum winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc"
"checksum winreg 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "e63857fb213f619b4c4fff86b158285c76766aac7e7474967e92fb6dbbfeefe9"

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

@ -27,7 +27,7 @@ slog-atomic = "0.4"
slog-stdlog = "1"
slog-stream = "1"
uuid = "0.1.18"
webdriver = "0.25"
webdriver = "0.26.0"
zip = "0.1"
[[bin]]

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

@ -25,7 +25,7 @@ use webdriver::command::WebDriverCommand::{
NewSession, DeleteSession, Status, Get, GetCurrentUrl,
GoBack, GoForward, Refresh, GetTitle, GetPageSource, GetWindowHandle,
GetWindowHandles, CloseWindow, SetWindowRect,
GetWindowRect, MaximizeWindow, SwitchToWindow, SwitchToFrame,
GetWindowRect, MaximizeWindow, FullscreenWindow, SwitchToWindow, SwitchToFrame,
SwitchToParentFrame, FindElement, FindElements,
FindElementElement, FindElementElements, GetActiveElement,
IsDisplayed, IsSelected, GetElementAttribute, GetElementProperty, GetCSSValue,
@ -801,6 +801,40 @@ impl MarionetteSession {
WebDriverResponse::ElementRect(ElementRectResponse::new(x, y, width, height))
},
FullscreenWindow => {
let width = try_opt!(
try_opt!(resp.result.find("width"),
ErrorStatus::UnknownError,
"Failed to find width field").as_u64(),
ErrorStatus::UnknownError,
"Failed to interpret width as integer");
let height = try_opt!(
try_opt!(resp.result.find("height"),
ErrorStatus::UnknownError,
"Failed to find height field").as_u64(),
ErrorStatus::UnknownError,
"Failed to interpret height as integer");
let x = try_opt!(
try_opt!(resp.result.find("x"),
ErrorStatus::UnknownError,
"Failed to find x field").as_i64(),
ErrorStatus::UnknownError,
"Failed to interpret x as integer");
let y = try_opt!(
try_opt!(resp.result.find("y"),
ErrorStatus::UnknownError,
"Failed to find y field").as_i64(),
ErrorStatus::UnknownError,
"Failed to interpret y as integer");
WebDriverResponse::WindowRect(WindowRectResponse {x: x,
y: y,
width: width,
height: height})
},
GetCookies => {
let cookies = try!(self.process_cookies(&resp.result));
WebDriverResponse::Cookie(CookieResponse::new(cookies))
@ -1034,6 +1068,7 @@ impl MarionetteCommand {
SetWindowRect(ref x) => (Some("setWindowRect"), Some(x.to_marionette())),
GetWindowRect => (Some("getWindowRect"), None),
MaximizeWindow => (Some("maximizeWindow"), None),
FullscreenWindow => (Some("fullscreenWindow"), None),
SwitchToWindow(ref x) => (Some("switchToWindow"), Some(x.to_marionette())),
SwitchToFrame(ref x) => (Some("switchToFrame"), Some(x.to_marionette())),
SwitchToParentFrame => (Some("switchToParentFrame"), None),