Bug 1271636 - Clarify language in error for GeckoDriver#setWindowSize; r=automatedtester

MozReview-Commit-ID: 6YhiDKdtFcT

--HG--
extra : rebase_source : 1fa4dfc5002b0d0ba48ea302a7d8e8d514f1e4c1
This commit is contained in:
Andreas Tolfsen 2016-05-18 11:35:20 +01:00
Родитель 54c922ca84
Коммит 79f1a7b3bc
2 изменённых файлов: 5 добавлений и 4 удалений

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

@ -2448,8 +2448,8 @@ GeckoDriver.prototype.setWindowSize = function(cmd, resp) {
let height = parseInt(cmd.parameters.height);
let win = this.getCurrentWindow();
if (width >= win.screen.availWidth && height >= win.screen.availHeight) {
throw new UnsupportedOperationError("Invalid requested size, cannot maximize");
if (width >= win.screen.availWidth || height >= win.screen.availHeight) {
throw new UnsupportedOperationError("Requested size exceeds screen size")
}
win.resizeTo(width, height);

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

@ -2,9 +2,10 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
from marionette_driver.errors import MarionetteException
from marionette_driver.errors import UnsupportedOperationException
from marionette import MarionetteTestCase
class TestSetWindowSize(MarionetteTestCase):
def setUp(self):
super(MarionetteTestCase, self).setUp()
@ -48,7 +49,7 @@ class TestSetWindowSize(MarionetteTestCase):
height = self.max_height - 100
self.marionette.set_window_size(width, height)
# invalid size (cannot maximize)
with self.assertRaisesRegexp(MarionetteException, "Invalid requested size"):
with self.assertRaisesRegexp(UnsupportedOperationException, "Requested size exceeds screen size"):
self.marionette.set_window_size(self.max_width, self.max_height)
size = self.marionette.window_size
self.assertEqual(size['width'], width, "Window width should not have changed")