зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1726465 - [marionette] In windowless mode allow closing the last content and chrome window. r=webdriver-reviewers,jdescottes
Depends on D134387 Differential Revision: https://phabricator.services.mozilla.com/D145574
This commit is contained in:
Родитель
6534c7686e
Коммит
21cd47b529
|
@ -0,0 +1,58 @@
|
|||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# 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 __future__ import absolute_import
|
||||
|
||||
from marionette_driver import errors, Wait
|
||||
from marionette_harness import MarionetteTestCase
|
||||
|
||||
|
||||
class TestWindowless(MarionetteTestCase):
|
||||
def setUp(self):
|
||||
super(TestWindowless, self).setUp()
|
||||
|
||||
self.marionette.delete_session()
|
||||
self.marionette.start_session({"moz:windowless": True})
|
||||
|
||||
def tearDown(self):
|
||||
# Reset the browser and active WebDriver session
|
||||
self.marionette.restart(in_app=True)
|
||||
self.marionette.delete_session()
|
||||
|
||||
super(TestWindowless, self).tearDown()
|
||||
|
||||
def test_last_chrome_window_can_be_closed(self):
|
||||
with self.marionette.using_context("chrome"):
|
||||
handles = self.marionette.chrome_window_handles
|
||||
self.assertGreater(len(handles), 0)
|
||||
self.marionette.switch_to_window(handles[0])
|
||||
self.marionette.close_chrome_window()
|
||||
self.assertEqual(len(self.marionette.chrome_window_handles), 0)
|
||||
|
||||
def test_last_content_window_can_be_closed(self):
|
||||
handles = self.marionette.window_handles
|
||||
self.assertGreater(len(handles), 0)
|
||||
self.marionette.switch_to_window(handles[0])
|
||||
self.marionette.close()
|
||||
self.assertEqual(len(self.marionette.window_handles), 0)
|
||||
|
||||
def test_no_window_handles_after_silent_restart(self):
|
||||
# Check that windows are present, but not after a silent restart
|
||||
handles = self.marionette.window_handles
|
||||
self.assertGreater(len(handles), 0)
|
||||
|
||||
self.marionette.restart(silent=True)
|
||||
with self.assertRaises(errors.TimeoutException):
|
||||
wait = Wait(
|
||||
self.marionette,
|
||||
ignored_exceptions=errors.NoSuchWindowException,
|
||||
timeout=5,
|
||||
)
|
||||
wait.until(lambda _: self.marionette.window_handles)
|
||||
|
||||
# After a normal restart a browser window will be opened again
|
||||
self.marionette.restart(in_app=True)
|
||||
handles = self.marionette.window_handles
|
||||
self.assertGreater(len(handles), 0)
|
||||
self.marionette.switch_to_window(handles[0])
|
|
@ -71,7 +71,8 @@ expected = fail
|
|||
[test_execute_isolate.py]
|
||||
[test_click_scrolling.py]
|
||||
[test_profile_management.py]
|
||||
skip-if = manage_instance == false || (debug && ((os == 'mac') || (os == 'linux'))) # Bug 1450355
|
||||
skip-if =
|
||||
manage_instance == false || (debug && ((os == 'mac') || (os == 'linux'))) # Bug 1450355
|
||||
[test_quit_restart.py]
|
||||
skip-if = manage_instance == false
|
||||
[test_context.py]
|
||||
|
@ -98,7 +99,8 @@ skip-if = manage_instance == false
|
|||
|
||||
[test_select.py]
|
||||
[test_crash.py]
|
||||
skip-if = asan || manage_instance == false
|
||||
skip-if =
|
||||
asan || manage_instance == false
|
||||
[test_localization.py]
|
||||
|
||||
[test_reftest.py]
|
||||
|
@ -109,3 +111,6 @@ skip-if =
|
|||
[test_sendkeys_menupopup_chrome.py]
|
||||
|
||||
[test_get_shadow_root.py]
|
||||
|
||||
[test_windowless.py]
|
||||
skip-if = os != 'mac' # only supported on MacOS
|
||||
|
|
Загрузка…
Ссылка в новой задаче