зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1364594: Exit fullscreen when Set Window Rect is invoked. r=ato
If the browser is in fullscreen mode and Set Window Rect is called we need to exit fullscreen mode and then continue to manipulate the browser. As described in https://w3c.github.io/webdriver/webdriver-spec.html#set-window-rect Step 10 MozReview-Commit-ID: 5ixhGOXVBE4 --HG-- extra : rebase_source : be2b8b6da5cf78c6263502a6cb422e2de81c742d
This commit is contained in:
Родитель
0fa24c7355
Коммит
c4d8c565b3
|
@ -1370,6 +1370,10 @@ GeckoDriver.prototype.setWindowRect = function* (cmd, resp) {
|
|||
|
||||
let {x, y, width, height} = cmd.parameters;
|
||||
|
||||
if (win.windowState == win.STATE_FULLSCREEN) {
|
||||
win.document.exitFullscreen();
|
||||
}
|
||||
|
||||
if (height != null && width != null) {
|
||||
assert.positiveInteger(height);
|
||||
assert.positiveInteger(width);
|
||||
|
|
|
@ -36,18 +36,16 @@ class TestWindowMaximize(MarionetteTestCase):
|
|||
else:
|
||||
delta = 8
|
||||
|
||||
self.assertAlmostEqual(
|
||||
actual["width"], self.max["width"],
|
||||
delta=delta,
|
||||
msg="Window width is not within {} px of availWidth: "
|
||||
"current width {} and max width {}"
|
||||
.format(delta, actual["width"], self.max["width"]))
|
||||
self.assertAlmostEqual(
|
||||
self.assertGreaterEqual(
|
||||
actual["width"], self.max["width"] - delta,
|
||||
msg="Window width is not within {delta} px of availWidth: "
|
||||
"current width {expected} should be greater than max width {max}"
|
||||
.format(delta=delta, expected=actual["width"], max=self.max["width"] - delta))
|
||||
self.assertGreaterEqual(
|
||||
actual["height"], self.max["height"],
|
||||
delta=delta,
|
||||
msg="Window height is not within {} px of availHeight, "
|
||||
"current height {} and max height {}"
|
||||
.format(delta, actual["height"], self.max["height"]))
|
||||
msg="Window height is not within {delta} px of availHeight: "
|
||||
"current height {expected} should be greater than max width {max}"
|
||||
.format(delta=delta, expected=actual["height"], max=self.max["height"] - delta))
|
||||
|
||||
def assert_window_restored(self, actual):
|
||||
self.assertEqual(self.original_size["width"], actual["width"])
|
||||
|
|
|
@ -121,8 +121,8 @@ class TestSize(MarionetteTestCase):
|
|||
# so reset to original size minus 1 pixel width
|
||||
start_size = self.marionette.window_size
|
||||
if start_size["width"] == self.max["width"] and start_size["height"] == self.max["height"]:
|
||||
start_size["width"] -= 1
|
||||
start_size["height"] -= 1
|
||||
start_size["width"] -= 10
|
||||
start_size["height"] -= 10
|
||||
self.marionette.set_window_size(start_size["width"], start_size["height"])
|
||||
|
||||
self.original_size = self.marionette.window_size
|
||||
|
@ -130,6 +130,9 @@ class TestSize(MarionetteTestCase):
|
|||
def tearDown(self):
|
||||
self.marionette.set_window_size(
|
||||
self.original_size["width"], self.original_size["height"])
|
||||
is_fullscreen = self.marionette.execute_script("return document.fullscreenElement;", sandbox=None)
|
||||
if is_fullscreen:
|
||||
self.marionette.fullscreen()
|
||||
super(MarionetteTestCase, self).tearDown()
|
||||
|
||||
def test_get_types(self):
|
||||
|
@ -190,3 +193,13 @@ class TestSize(MarionetteTestCase):
|
|||
height=self.max["height"])
|
||||
self.assertEqual(result["width"], self.max["width"])
|
||||
self.assertEqual(result["height"], self.max["height"])
|
||||
|
||||
def test_resize_while_fullscreen(self):
|
||||
self.marionette.fullscreen()
|
||||
result = self.marionette.set_window_rect(width=self.max["width"] - 100,
|
||||
height=self.max["height"] - 100)
|
||||
|
||||
self.assertTrue(self.marionette.execute_script("return window.fullscreenElement == null",
|
||||
sandbox=None))
|
||||
self.assertEqual(result["width"], self.max["width"] - 100)
|
||||
self.assertEqual(result["height"], self.max["height"] - 100)
|
||||
|
|
Загрузка…
Ссылка в новой задаче