summaryrefslogtreecommitdiffstats
path: root/testing/marionette/harness/marionette_harness/tests/unit/test_chrome.py
blob: 3efe769f0ab273a2432c8d946cc3a1d942a3e67f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
from __future__ import absolute_import

from marionette_harness import MarionetteTestCase, WindowManagerMixin


class ChromeTests(WindowManagerMixin, MarionetteTestCase):
    def setUp(self):
        super(ChromeTests, self).setUp()

    def tearDown(self):
        self.close_all_windows()
        super(ChromeTests, self).tearDown()

    def test_hang_until_timeout(self):
        with self.marionette.using_context("chrome"):
            new_window = self.open_window()
        self.marionette.switch_to_window(new_window)

        try:
            try:
                # Raise an exception type which should not be thrown by Marionette
                # while running this test. Otherwise it would mask eg. IOError as
                # thrown for a socket timeout.
                raise NotImplementedError(
                    "Exception should not cause a hang when "
                    "closing the chrome window in content "
                    "context"
                )
            finally:
                self.marionette.close_chrome_window()
                self.marionette.switch_to_window(self.start_window)
        except NotImplementedError:
            pass