summaryrefslogtreecommitdiffstats
path: root/toolkit/xre/test/marionette/test_exitcode.py
blob: 4ce730612253e7573b1605a5d15ee187b9e45706 (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
from marionette_harness import MarionetteTestCase


class TestFissionAutostart(MarionetteTestCase):
    def test_normal_exit(self):
        self.marionette.set_context(self.marionette.CONTEXT_CHROME)

        def call_quit():
            self.marionette.execute_script(
                """
                Services.startup.quit(Ci.nsIAppStartup.eAttemptQuit);
                """,
                sandbox="system",
            )

        self.marionette.quit(callback=call_quit)
        self.assertEqual(self.marionette.instance.runner.returncode, 0)

    def test_exit_code(self):
        self.marionette.set_context(self.marionette.CONTEXT_CHROME)

        def call_quit():
            self.marionette.execute_script(
                """
                Services.startup.quit(Ci.nsIAppStartup.eAttemptQuit, 5);
                """,
                sandbox="system",
            )

        self.marionette.quit(callback=call_quit)
        self.assertEqual(self.marionette.instance.runner.returncode, 5)