mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-16 23:05:42 +00:00
Bug 1280101 - Remove check for window sizes larger than screen; r=automatedtester
MozReview-Commit-ID: K2l0pPfGbGp --HG-- extra : rebase_source : 943524c2a4e1dd990fa9cfddcc99cc7074ec1922
This commit is contained in:
parent
b196cce6f4
commit
de6084520f
@ -2490,23 +2490,14 @@ GeckoDriver.prototype.getWindowSize = function(cmd, resp) {
|
||||
* Not supported on B2G. The supplied width and height values refer to
|
||||
* the window outerWidth and outerHeight values, which include scroll
|
||||
* bars, title bars, etc.
|
||||
*
|
||||
* An error will be returned if the requested window size would result
|
||||
* in the window being in the maximized state.
|
||||
*/
|
||||
GeckoDriver.prototype.setWindowSize = function(cmd, resp) {
|
||||
if (this.appName != "Firefox") {
|
||||
throw new UnsupportedOperationError();
|
||||
}
|
||||
|
||||
let width = cmd.parameters.width;
|
||||
let height = cmd.parameters.height;
|
||||
|
||||
let {width, height} = cmd.parameters;
|
||||
let win = this.getCurrentWindow();
|
||||
if (width >= win.screen.availWidth || height >= win.screen.availHeight) {
|
||||
throw new UnsupportedOperationError("Requested size exceeds screen size")
|
||||
}
|
||||
|
||||
win.resizeTo(width, height);
|
||||
};
|
||||
|
||||
|
@ -43,17 +43,13 @@ class TestSetWindowSize(MarionetteTestCase):
|
||||
self.assertEqual(size['height'], height,
|
||||
"Window height is %s but should be %s" % (size['height'], height))
|
||||
|
||||
def test_that_we_throw_an_error_when_trying_to_set_maximum_size(self):
|
||||
# valid size
|
||||
width = self.max_width - 100
|
||||
height = self.max_height - 100
|
||||
self.marionette.set_window_size(width, height)
|
||||
# invalid size (cannot maximize)
|
||||
with self.assertRaisesRegexp(UnsupportedOperationException, "Requested size exceeds screen size"):
|
||||
self.marionette.set_window_size(self.max_width, self.max_height)
|
||||
def test_possible_to_request_window_larger_than_screen(self):
|
||||
self.marionette.set_window_size(100000, 100000)
|
||||
size = self.marionette.window_size
|
||||
self.assertEqual(size['width'], width, "Window width should not have changed")
|
||||
self.assertEqual(size['height'], height, "Window height should not have changed")
|
||||
|
||||
# In X the window size may be greater than the bounds of the screen
|
||||
self.assertGreaterEqual(size["width"], self.max_width)
|
||||
self.assertGreaterEqual(size["height"], self.max_height)
|
||||
|
||||
def test_that_we_can_maximise_the_window(self):
|
||||
# valid size
|
||||
|
Loading…
Reference in New Issue
Block a user