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
3 import os
4 import threading
5 from time import sleep
6 import unittest
8 import mozrunnertest
11 class RunnerThread(threading.Thread):
12 def __init__(self, runner, timeout=10):
13 threading.Thread.__init__(self)
14 self.runner = runner
15 self.timeout = timeout
17 def run(self):
18 sleep(self.timeout)
19 self.runner.stop()
22 class MozrunnerInteractiveTestCase(mozrunnertest.MozrunnerTestCase):
24 def test_run_interactive(self):
25 """Bug 965183: Run process in interactive mode and call wait()"""
26 pid = self.runner.start(interactive=True)
27 self.pids.append(pid)
29 thread = RunnerThread(self.runner, 5)
30 self.threads.append(thread)
31 thread.start()
33 # This is a blocking call. So the process should be killed by the thread
34 self.runner.wait()
35 thread.join()
36 self.assertFalse(self.runner.is_running())
38 def test_stop_interactive(self):
39 """Bug 965183: Explicitely stop process in interactive mode"""
40 pid = self.runner.start(interactive=True)
41 self.pids.append(pid)
43 self.runner.stop()
45 def test_wait_after_process_finished(self):
46 """Wait after the process has been stopped should not raise an error"""
47 self.runner.start(interactive=True)
48 sleep(5)
49 self.runner.process_handler.kill()
51 returncode = self.runner.wait(1)
53 self.assertNotIn(returncode, [None, 0])
54 self.assertIsNotNone(self.runner.process_handler)