Bug 1328696 - Remove usage of enforce_gecko_prefs() from test_modal_dialogs.py.
The preference prompts.tab_modal.enabled doesn't need a restart of Firefox. It
means there is no need to use enforce_gecko_prefs() for the tests.
MozReview-Commit-ID: 4tPBPV5v7X4
--- a/testing/marionette/harness/marionette_harness/tests/unit/test_modal_dialogs.py
+++ b/testing/marionette/harness/marionette_harness/tests/unit/test_modal_dialogs.py
@@ -8,32 +8,34 @@ from marionette_driver.marionette import
from marionette_driver.wait import Wait
from marionette_harness import MarionetteTestCase, skip_if_e10s
class TestTabModals(MarionetteTestCase):
def setUp(self):
- MarionetteTestCase.setUp(self)
- self.marionette.enforce_gecko_prefs({"prompts.tab_modal.enabled": True})
+ super(TestTabModals, self).setUp()
+ self.marionette.set_pref("prompts.tab_modal.enabled", True)
self.marionette.navigate(self.marionette.absolute_url('modal_dialogs.html'))
+ def tearDown(self):
+ # Ensure an alert is absent before proceeding past this test.
+ Wait(self.marionette).until(lambda _: not self.alert_present())
+ self.marionette.execute_script("window.onbeforeunload = null;")
+ self.marionette.clear_pref("prompts.tab_modal.enabled")
+ super(TestTabModals, self).tearDown()
+
def alert_present(self):
try:
Alert(self.marionette).text
return True
except NoAlertPresentException:
return False
- def tearDown(self):
- # Ensure an alert is absent before proceeding past this test.
- Wait(self.marionette).until(lambda _: not self.alert_present())
- self.marionette.execute_script("window.onbeforeunload = null;")
-
def wait_for_alert(self):
Wait(self.marionette).until(lambda _: self.alert_present())
def test_no_alert_raises(self):
self.assertRaises(NoAlertPresentException, Alert(self.marionette).accept)
self.assertRaises(NoAlertPresentException, Alert(self.marionette).dismiss)
def test_alert_accept(self):
@@ -182,16 +184,15 @@ class TestTabModals(MarionetteTestCase):
click_handler.click()
text = self.marionette.find_element(By.ID, 'click-result').text
self.assertEqual(text, 'result')
class TestGlobalModals(TestTabModals):
def setUp(self):
- MarionetteTestCase.setUp(self)
- self.marionette.enforce_gecko_prefs({"prompts.tab_modal.enabled": False})
- self.marionette.navigate(self.marionette.absolute_url('modal_dialogs.html'))
+ super(TestGlobalModals, self).setUp()
+ self.marionette.set_pref("prompts.tab_modal.enabled", False)
def test_unrelated_command_when_alert_present(self):
# The assumptions in this test do not hold on certain platforms, and not when
# e10s is enabled.
pass
--- a/testing/marionette/harness/marionette_harness/tests/unit/unit-tests.ini
+++ b/testing/marionette/harness/marionette_harness/tests/unit/unit-tests.ini
@@ -98,17 +98,16 @@ skip-if = true # Bug 925688
skip-if = manage_instance == false || appname == 'fennec' # Bug 1298921 and bug 1322993
[test_quit_restart.py]
skip-if = manage_instance == false || appname == 'fennec' # Bug 1298921 and bug 1322993
[test_set_window_size.py]
skip-if = os == "linux" || appname == 'fennec' # Bug 1085717
[test_with_using_context.py]
[test_modal_dialogs.py]
-skip-if = manage_instance == false || appname == 'fennec' # Bug 1328696
[test_key_actions.py]
[test_mouse_action.py]
skip-if = appname == 'fennec'
[test_teardown_context_preserved.py]
[test_file_upload.py]
skip-if = appname == 'fennec' || os == "win" # http://bugs.python.org/issue14574
[test_execute_sandboxes.py]