Bug 1258316 - Have marionette call maximize() on window instead of resize r?ato
This allows use to be able restore the window size if we wanted to.
MozReview-Commit-ID: Kx3JH1UroI2
--- a/testing/marionette/driver.js
+++ b/testing/marionette/driver.js
@@ -2664,18 +2664,17 @@ GeckoDriver.prototype.setWindowSize = fu
* Not Supported on B2G or Fennec.
*/
GeckoDriver.prototype.maximizeWindow = function(cmd, resp) {
if (this.appName != "Firefox") {
throw new UnsupportedOperationError();
}
let win = this.getCurrentWindow();
- win.moveTo(0,0);
- win.resizeTo(win.screen.availWidth, win.screen.availHeight);
+ win.maximize()
};
/**
* Dismisses a currently displayed tab modal, or returns no such alert if
* no modal is displayed.
*/
GeckoDriver.prototype.dismissDialog = function(cmd, resp) {
if (!this.dialog) {
--- a/testing/marionette/harness/marionette/tests/unit/test_set_window_size.py
+++ b/testing/marionette/harness/marionette/tests/unit/test_set_window_size.py
@@ -66,10 +66,12 @@ class TestSetWindowSize(MarionetteTestCa
window.onresize = function() {
window.wrappedJSObject.rcvd_event = true;
};
""")
self.marionette.maximize_window()
self.wait_for_condition(lambda m: m.execute_script("return window.wrappedJSObject.rcvd_event;"))
size = self.marionette.window_size
- self.assertEqual(size['width'], self.max_width, "Window width does not use availWidth")
- self.assertEqual(size['height'], self.max_height, "Window height does not use availHeight")
+ self.assertGreaterEqual(size['width'], self.max_width,
+ "Window width does not use availWidth, current width: {0}, max width: {1}".format(size['width'], self.max_width))
+ self.assertGreaterEqual(size['height'], self.max_height,
+ "Window height does not use availHeight. current width: {0}, max width: {1}".format(size['height'], self.max_height))