Bug 1380936 - Add Minimize Window command to geckodriver; r=ato draft
authorYangyi Peng<yangyi_peng@htc.com>
Tue, 01 Aug 2017 11:42:58 +0800
changeset 619454 2120abbe4a4c57be3d669f02e29dc2ac03b1a90f
parent 617159 556f19ef392ac2d9aac579864e2179d6c1d464e8
child 640398 5ec7b4479f79c86d8bb88efe8712832c0b9bc141
push id71680
push userbmo:yangyi_peng@htc.com
push dateWed, 02 Aug 2017 02:02:17 +0000
reviewersato
bugs1380936
milestone56.0a1
Bug 1380936 - Add Minimize Window command to geckodriver; r=ato MozReview-Commit-ID: Le6rAUMDjwe
testing/geckodriver/Cargo.lock
testing/geckodriver/Cargo.toml
testing/geckodriver/src/marionette.rs
third_party/rust/webdriver/.cargo-checksum.json
third_party/rust/webdriver/Cargo.toml
third_party/rust/webdriver/src/command.rs
third_party/rust/webdriver/src/httpapi.rs
--- a/testing/geckodriver/Cargo.lock
+++ b/testing/geckodriver/Cargo.lock
@@ -12,17 +12,17 @@ dependencies = [
  "mozversion 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
  "regex 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
  "rustc-serialize 0.3.22 (registry+https://github.com/rust-lang/crates.io-index)",
  "slog 1.5.2 (registry+https://github.com/rust-lang/crates.io-index)",
  "slog-atomic 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)",
  "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.27.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "webdriver 0.28.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "zip 0.1.19 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
 [[package]]
 name = "advapi32-sys"
 version = "0.1.2"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 dependencies = [
@@ -631,17 +631,17 @@ source = "registry+https://github.com/ru
 
 [[package]]
 name = "void"
 version = "1.0.2"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 
 [[package]]
 name = "webdriver"
-version = "0.27.0"
+version = "0.28.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)",
  "cookie 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)",
  "hyper 0.10.10 (registry+https://github.com/rust-lang/crates.io-index)",
  "log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
  "regex 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
  "rustc-serialize 0.3.22 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -758,13 +758,13 @@ dependencies = [
 "checksum unicode-segmentation 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "18127285758f0e2c6cf325bb3f3d138a12fee27de4f23e146cd6a179f26c2cf3"
 "checksum unicode-width 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "bf3a113775714a22dcb774d8ea3655c53a32debae63a063acc00a91cc586245f"
 "checksum unreachable 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "1f2ae5ddb18e1c92664717616dd9549dde73f539f01bd7b77c2edb2446bdff91"
 "checksum url 1.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3e2ba3456fbe5c0098cb877cf08b92b76c3e18e0be9e47c35b487220d377d24e"
 "checksum utf8-ranges 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "662fab6525a98beff2921d7f61a39e7d59e0b425ebc7d0d9e66d316e55124122"
 "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.27.0 (registry+https://github.com/rust-lang/crates.io-index)" = "26cd8cf65699e3b8d1a21088ba2180cfe4f5d37a414c994976a34b289799e24d"
+"checksum webdriver 0.28.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9238218a263593f2f143c32d10b0ddec2664a1f9b7be426eb775ee243af44739"
 "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"
 "checksum zip 0.1.19 (registry+https://github.com/rust-lang/crates.io-index)" = "c0deac03fc7d43abcf19f2c2db6bd9289f9ea3d31f350e26eb0ed8b4117983c1"
--- a/testing/geckodriver/Cargo.toml
+++ b/testing/geckodriver/Cargo.toml
@@ -22,13 +22,13 @@ mozrunner = "0.4.1"
 mozversion = "0.1.2"
 regex = "0.2"
 rustc-serialize = "0.3"
 slog = "1"
 slog-atomic = "0.4"
 slog-stdlog = "1"
 slog-stream = "1"
 uuid = "0.1.18"
-webdriver = "0.27.0"
+webdriver = "0.28.0"
 zip = "0.1"
 
 [[bin]]
 name = "geckodriver"
--- a/testing/geckodriver/src/marionette.rs
+++ b/testing/geckodriver/src/marionette.rs
@@ -23,18 +23,18 @@ use std::thread::sleep;
 use std::time::Duration;
 use uuid::Uuid;
 use webdriver::capabilities::CapabilitiesMatching;
 use webdriver::command::{WebDriverCommand, WebDriverMessage, Parameters,
                          WebDriverExtensionCommand};
 use webdriver::command::WebDriverCommand::{
     NewSession, DeleteSession, Status, Get, GetCurrentUrl,
     GoBack, GoForward, Refresh, GetTitle, GetPageSource, GetWindowHandle,
-    GetWindowHandles, CloseWindow, SetWindowRect,
-    GetWindowRect, MaximizeWindow, FullscreenWindow, SwitchToWindow, SwitchToFrame,
+    GetWindowHandles, CloseWindow, SetWindowRect, GetWindowRect,
+    MinimizeWindow, MaximizeWindow, FullscreenWindow, SwitchToWindow, SwitchToFrame,
     SwitchToParentFrame, FindElement, FindElements,
     FindElementElement, FindElementElements, GetActiveElement,
     IsDisplayed, IsSelected, GetElementAttribute, GetElementProperty, GetCSSValue,
     GetElementText, GetElementTagName, GetElementRect, IsEnabled,
     ElementClick, ElementTap, ElementClear, ElementSendKeys,
     ExecuteScript, ExecuteAsyncScript, GetCookies, GetNamedCookie, AddCookie,
     DeleteCookies, DeleteCookie, GetTimeouts, SetTimeouts, DismissAlert,
     AcceptAlert, GetAlertText, SendAlertText, TakeScreenshot, TakeElementScreenshot,
@@ -757,17 +757,17 @@ impl MarionetteSession {
                     try_opt!(resp.result.find("height"),
                              ErrorStatus::UnknownError,
                              "Failed to find height field").as_f64(),
                     ErrorStatus::UnknownError,
                     "Failed to interpret width as float");
 
                 WebDriverResponse::ElementRect(RectResponse::new(x, y, width, height))
             },
-            FullscreenWindow | MaximizeWindow | GetWindowRect |
+            FullscreenWindow | MinimizeWindow | MaximizeWindow | GetWindowRect |
             SetWindowRect(_) => {
                 let width = try_opt!(
                     try_opt!(resp.result.find("width"),
                              ErrorStatus::UnknownError,
                              "Failed to find width field").as_f64(),
                     ErrorStatus::UnknownError,
                     "Failed to interpret width as float");
 
@@ -1034,16 +1034,17 @@ impl MarionetteCommand {
             GetPageSource => (Some("getPageSource"), None),
             GetWindowHandle => (Some("getWindowHandle"), None),
             GetWindowHandles => (Some("getWindowHandles"), None),
             CloseWindow => (Some("close"), None),
             GetTimeouts => (Some("getTimeouts"), None),
             SetTimeouts(ref x) => (Some("setTimeouts"), Some(x.to_marionette())),
             SetWindowRect(ref x) => (Some("setWindowRect"), Some(x.to_marionette())),
             GetWindowRect => (Some("getWindowRect"), None),
+            MinimizeWindow => (Some("WebDriver:MinimizeWindow"), 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),
             FindElement(ref x) => (Some("findElement"), Some(x.to_marionette())),
             FindElements(ref x) => (Some("findElements"), Some(x.to_marionette())),
             FindElementElement(ref e, ref x) => {
--- a/third_party/rust/webdriver/.cargo-checksum.json
+++ b/third_party/rust/webdriver/.cargo-checksum.json
@@ -1,1 +1,1 @@
-{"files":{".cargo-ok":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",".travis.yml":"78252ef89a407b1d76616b7afbf7afb8205530a7f7039f3a7ea140684e3aa8bc","Cargo.toml":"b5a8bd0fff8cc291a345626ccd8fb5bd958ec2f59cc58760870897b727631226","LICENSE":"fab3dd6bdab226f1c08630b1dd917e11fcb4ec5e1e020e2c16f83a0a13863e85","README.md":"bd0e99ce271903a9f67cf5f8fca2f67f2583e4336fbaf583fcd78ec238d4176e","src/capabilities.rs":"5039c1f80885ca2bab19f2d1c40b405c37c09901918625395141ac2e01600728","src/command.rs":"4bc0380b3e8916dd7514f751b18b47bf510c1fa16d9832617cf0ce5470d87797","src/common.rs":"d696aabe88061f8315578c42115d976123a8fc4276384e478e14d241dfc9acc0","src/error.rs":"b0acf64e052edbc26e7dbcd1a54e8b9a786f01e9d48e0e5b2f410266bfdb9da2","src/httpapi.rs":"44f1061123580ebb73ddd164a18cb223e16445c6a2eabd91f14c39d6a3d282e1","src/lib.rs":"336c146e934711dfe49f4b44bbcf278686b00be8d89abb9c7b7b045254994fbf","src/macros.rs":"93094c48e3880d925e684fba9678693eb8c0c39c7ed47b130b0751c4bca37ddc","src/response.rs":"63cabdc7f9136a0f24c10dc16b11c6991c95fd9fee1d1bc47d48c62c6f69eb33","src/server.rs":"f2110378cfaf7a4facb39d0e45c479a00c95a939536c85a6a105c858fffc2d70"},"package":"26cd8cf65699e3b8d1a21088ba2180cfe4f5d37a414c994976a34b289799e24d"}
\ No newline at end of file
+{"files":{".cargo-ok":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",".travis.yml":"78252ef89a407b1d76616b7afbf7afb8205530a7f7039f3a7ea140684e3aa8bc","Cargo.toml":"74d24167dc8948953ab5c43b9a524b8ecff667c2f1ce9c0df539c1b799077998","LICENSE":"fab3dd6bdab226f1c08630b1dd917e11fcb4ec5e1e020e2c16f83a0a13863e85","README.md":"bd0e99ce271903a9f67cf5f8fca2f67f2583e4336fbaf583fcd78ec238d4176e","src/capabilities.rs":"5039c1f80885ca2bab19f2d1c40b405c37c09901918625395141ac2e01600728","src/command.rs":"2e60c1b0eabccc3abef91574dbb94a4044a56fc1f4da18a45c6317c726480c2f","src/common.rs":"d696aabe88061f8315578c42115d976123a8fc4276384e478e14d241dfc9acc0","src/error.rs":"b0acf64e052edbc26e7dbcd1a54e8b9a786f01e9d48e0e5b2f410266bfdb9da2","src/httpapi.rs":"8e54ddc2796863ce7d9905484fb8214883a27a33bd94bee2ae765bccb9895f91","src/lib.rs":"336c146e934711dfe49f4b44bbcf278686b00be8d89abb9c7b7b045254994fbf","src/macros.rs":"93094c48e3880d925e684fba9678693eb8c0c39c7ed47b130b0751c4bca37ddc","src/response.rs":"63cabdc7f9136a0f24c10dc16b11c6991c95fd9fee1d1bc47d48c62c6f69eb33","src/server.rs":"f2110378cfaf7a4facb39d0e45c479a00c95a939536c85a6a105c858fffc2d70"},"package":"9238218a263593f2f143c32d10b0ddec2664a1f9b7be426eb775ee243af44739"}
\ No newline at end of file
--- a/third_party/rust/webdriver/Cargo.toml
+++ b/third_party/rust/webdriver/Cargo.toml
@@ -7,40 +7,40 @@
 #
 # If you believe there's an error in this file please file an
 # issue against the rust-lang/cargo repository. If you're
 # editing this file be aware that the upstream Cargo.toml
 # will likely look very different (and much more reasonable)
 
 [package]
 name = "webdriver"
-version = "0.27.0"
+version = "0.28.0"
 authors = ["Mozilla Tools and Automation <tools@lists.mozilla.com>"]
 description = "Library implementing the wire protocol for the W3C WebDriver specification"
 documentation = "https://docs.rs/webdriver"
 readme = "README.md"
 keywords = ["webdriver", "browser", "automation", "protocol", "w3c"]
 license = "MPL-2.0"
 repository = "https://github.com/mozilla/webdriver-rust"
 [dependencies.log]
 version = "0.3"
 
+[dependencies.backtrace]
+version = "0.3"
+
+[dependencies.regex]
+version = "0.2"
+
+[dependencies.rustc-serialize]
+version = "0.3"
+
+[dependencies.cookie]
+version = "0.9"
+default-features = false
+
+[dependencies.time]
+version = "0.1"
+
 [dependencies.hyper]
 version = "0.10"
 
 [dependencies.url]
 version = "1"
-
-[dependencies.backtrace]
-version = "0.3"
-
-[dependencies.rustc-serialize]
-version = "0.3"
-
-[dependencies.time]
-version = "0.1"
-
-[dependencies.regex]
-version = "0.2"
-
-[dependencies.cookie]
-version = "0.9"
-default-features = false
--- a/third_party/rust/webdriver/src/command.rs
+++ b/third_party/rust/webdriver/src/command.rs
@@ -20,16 +20,17 @@ pub enum WebDriverCommand<T: WebDriverEx
     Refresh,
     GetTitle,
     GetPageSource,
     GetWindowHandle,
     GetWindowHandles,
     CloseWindow,
     GetWindowRect,
     SetWindowRect(WindowRectParameters),
+    MinimizeWindow,
     MaximizeWindow,
     FullscreenWindow,
     SwitchToWindow(SwitchToWindowParameters),
     SwitchToFrame(SwitchToFrameParameters),
     SwitchToParentFrame,
     FindElement(LocatorParameters),
     FindElements(LocatorParameters),
     FindElementElement(WebElement, LocatorParameters),
@@ -130,16 +131,17 @@ impl<U: WebDriverExtensionRoute> WebDriv
                 let parameters: TimeoutsParameters = try!(Parameters::from_json(&body_data));
                 WebDriverCommand::SetTimeouts(parameters)
             },
             Route::GetWindowRect | Route::GetWindowPosition | Route::GetWindowSize => WebDriverCommand::GetWindowRect,
             Route::SetWindowRect | Route::SetWindowPosition | Route::SetWindowSize => {
                 let parameters: WindowRectParameters = Parameters::from_json(&body_data)?;
                 WebDriverCommand::SetWindowRect(parameters)
             },
+            Route::MinimizeWindow => WebDriverCommand::MinimizeWindow,
             Route::MaximizeWindow => WebDriverCommand::MaximizeWindow,
             Route::FullscreenWindow => WebDriverCommand::FullscreenWindow,
             Route::SwitchToWindow => {
                 let parameters: SwitchToWindowParameters = try!(Parameters::from_json(&body_data));
                 WebDriverCommand::SwitchToWindow(parameters)
             }
             Route::SwitchToFrame => {
                 let parameters: SwitchToFrameParameters = try!(Parameters::from_json(&body_data));
@@ -396,16 +398,17 @@ impl <U:WebDriverExtensionRoute> ToJson 
             WebDriverCommand::GetWindowHandle |
             WebDriverCommand::GetWindowHandles |
             WebDriverCommand::GetWindowRect |
             WebDriverCommand::GoBack |
             WebDriverCommand::GoForward |
             WebDriverCommand::IsDisplayed(_) |
             WebDriverCommand::IsEnabled(_) |
             WebDriverCommand::IsSelected(_) |
+            WebDriverCommand::MinimizeWindow |
             WebDriverCommand::MaximizeWindow |
             WebDriverCommand::FullscreenWindow |
             WebDriverCommand::NewSession(_) |
             WebDriverCommand::Refresh |
             WebDriverCommand::Status |
             WebDriverCommand::SwitchToParentFrame |
             WebDriverCommand::TakeElementScreenshot(_) |
             WebDriverCommand::TakeScreenshot => {
--- a/third_party/rust/webdriver/src/httpapi.rs
+++ b/third_party/rust/webdriver/src/httpapi.rs
@@ -22,16 +22,17 @@ fn standard_routes<U:WebDriverExtensionR
                 (Get, "/session/{sessionId}/window/handles", Route::GetWindowHandles),
                 (Delete, "/session/{sessionId}/window", Route::CloseWindow),
                 (Get, "/session/{sessionId}/window/size", Route::GetWindowSize),
                 (Post, "/session/{sessionId}/window/size", Route::SetWindowSize),
                 (Get, "/session/{sessionId}/window/position", Route::GetWindowPosition),
                 (Post, "/session/{sessionId}/window/position", Route::SetWindowPosition),
                 (Get, "/session/{sessionId}/window/rect", Route::GetWindowRect),
                 (Post, "/session/{sessionId}/window/rect", Route::SetWindowRect),
+                (Post, "/session/{sessionId}/window/minimize", Route::MinimizeWindow),
                 (Post, "/session/{sessionId}/window/maximize", Route::MaximizeWindow),
                 (Post, "/session/{sessionId}/window/fullscreen", Route::FullscreenWindow),
                 (Post, "/session/{sessionId}/window", Route::SwitchToWindow),
                 (Post, "/session/{sessionId}/frame", Route::SwitchToFrame),
                 (Post, "/session/{sessionId}/frame/parent", Route::SwitchToParentFrame),
                 (Post, "/session/{sessionId}/element", Route::FindElement),
                 (Post, "/session/{sessionId}/elements", Route::FindElements),
                 (Post, "/session/{sessionId}/element/{elementId}/element", Route::FindElementElement),
@@ -85,16 +86,17 @@ pub enum Route<U:WebDriverExtensionRoute
     GetWindowHandles,
     CloseWindow,
     GetWindowSize,  // deprecated
     SetWindowSize,  // deprecated
     GetWindowPosition,  // deprecated
     SetWindowPosition,  // deprecated
     GetWindowRect,
     SetWindowRect,
+    MinimizeWindow,
     MaximizeWindow,
     FullscreenWindow,
     SwitchToWindow,
     SwitchToFrame,
     SwitchToParentFrame,
     FindElement,
     FindElements,
     FindElementElement,