Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
1 #!/usr/bin/env python
2 # This Source Code Form is subject to the terms of the Mozilla Public
3 # License, v. 2.0. If a copy of the MPL was not distributed with this file,
4 # You can obtain one at http://mozilla.org/MPL/2.0/.
6 import os
7 import signal
9 import mozrunnertest
12 class MozrunnerStopTestCase(mozrunnertest.MozrunnerTestCase):
14 def test_stop_process(self):
15 """Stop the process and test properties"""
16 self.runner.start()
17 returncode = self.runner.stop()
19 self.assertFalse(self.runner.is_running())
20 self.assertNotIn(returncode, [None, 0])
21 self.assertEqual(self.runner.returncode, returncode)
22 self.assertIsNotNone(self.runner.process_handler)
24 self.assertEqual(self.runner.wait(1), returncode)
26 def test_stop_before_start(self):
27 """Stop the process before it gets started should not raise an error"""
28 returncode = self.runner.stop()
30 def test_stop_process_custom_signal(self):
31 """Stop the process via a custom signal and test properties"""
32 self.runner.start()
33 returncode = self.runner.stop(signal.SIGTERM)
35 self.assertFalse(self.runner.is_running())
36 self.assertNotIn(returncode, [None, 0])
37 self.assertEqual(self.runner.returncode, returncode)
38 self.assertIsNotNone(self.runner.process_handler)
40 self.assertEqual(self.runner.wait(1), returncode)