зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1298803 - Add test to quit Firefox via a shortcut; r=whimboo
MozReview-Commit-ID: 9z1u0gWj1Wf --HG-- extra : rebase_source : 2be4e270068a03647fb3d48976006a6c3760042e
This commit is contained in:
Родитель
090b9a4ef3
Коммит
749f6ddade
|
@ -2,6 +2,9 @@
|
||||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
# 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/.
|
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||||
|
|
||||||
|
import sys
|
||||||
|
import unittest
|
||||||
|
|
||||||
from firefox_puppeteer import PuppeteerMixin
|
from firefox_puppeteer import PuppeteerMixin
|
||||||
from marionette_driver import Wait
|
from marionette_driver import Wait
|
||||||
from marionette_harness import MarionetteTestCase
|
from marionette_harness import MarionetteTestCase
|
||||||
|
@ -54,3 +57,25 @@ class TestBrowserWindowShortcuts(PuppeteerMixin, MarionetteTestCase):
|
||||||
return selection_name == "input"
|
return selection_name == "input"
|
||||||
|
|
||||||
Wait(self.marionette).until(has_input_selected)
|
Wait(self.marionette).until(has_input_selected)
|
||||||
|
|
||||||
|
|
||||||
|
@unittest.skipIf(sys.platform == 'darwin',
|
||||||
|
'Quit Shotcut not supported due to native menu of Mac OS')
|
||||||
|
class TestBrowserQuitShortcut(PuppeteerMixin, MarionetteTestCase):
|
||||||
|
|
||||||
|
def test_quit_firefox_shortcut(self):
|
||||||
|
def quit_via_shortcut_callback():
|
||||||
|
if self.puppeteer.platform == 'win':
|
||||||
|
key = 'quitApplicationCmdWin2.accesskey'
|
||||||
|
else:
|
||||||
|
key = 'quitApplicationCmdUnix.key'
|
||||||
|
|
||||||
|
self.browser.send_shortcut(self.browser.localize_entity(key),
|
||||||
|
accel=True)
|
||||||
|
|
||||||
|
self.marionette.quit(in_app=True, callback=quit_via_shortcut_callback)
|
||||||
|
self.assertIsNone(self.marionette.session)
|
||||||
|
|
||||||
|
def tearDown(self):
|
||||||
|
self.marionette.start_session()
|
||||||
|
super(TestBrowserQuitShortcut, self).tearDown()
|
||||||
|
|
|
@ -409,8 +409,7 @@ class BaseWindow(BaseLib):
|
||||||
if kwargs[modifier] is True:
|
if kwargs[modifier] is True:
|
||||||
keys.append(keymap[modifier])
|
keys.append(keymap[modifier])
|
||||||
|
|
||||||
# Bug 1125209 - Only lower-case command keys should be sent
|
keys.append(command_key)
|
||||||
keys.append(command_key.lower())
|
|
||||||
|
|
||||||
self.switch_to()
|
self.switch_to()
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче