コード例 #1
0
    def test_win32_start_and_stop(self):
        host = MockHost()
        test_port = test.TestPort(host)
        test_port._path_to_crash_service = lambda: "/mock/crash_service"

        host.platform.is_win = lambda: True
        host.platform.is_cygwin = lambda: False

        server = CrashService(test_port, "/mock/crash_dumps_dir")
        server._check_that_all_ports_are_available = lambda: True
        server._is_server_running_on_all_ports = lambda: True

        server.start()
        self.assertNotEquals(host.executive.calls, [])

        def wait_for_action(action):
            if action():
                return True
            return action()

        def mock_returns(return_values):
            def return_value_thunk(*args, **kwargs):
                return return_values.pop(0)
            return return_value_thunk

        host.executive.check_running_pid = mock_returns([True, False])
        server._wait_for_action = wait_for_action

        server.stop()
        self.assertEqual(['taskkill.exe', '/f', '/t', '/pid', 42], host.executive.calls[1])
コード例 #2
0
    def test_win32_start_and_stop(self):
        host = MockHost()
        test_port = test.TestPort(host)
        test_port._path_to_crash_service = lambda: "/mock/crash_service"

        host.platform.is_win = lambda: True
        host.platform.is_cygwin = lambda: False

        server = CrashService(test_port, "/mock/crash_dumps_dir")
        server._check_that_all_ports_are_available = lambda: True
        server._is_server_running_on_all_ports = lambda: True

        server.start()
        self.assertNotEquals(host.executive.calls, [])

        def wait_for_action(action):
            if action():
                return True
            return action()

        def mock_returns(return_values):
            def return_value_thunk(*args, **kwargs):
                return return_values.pop(0)
            return return_value_thunk

        host.executive.check_running_pid = mock_returns([True, False])
        server._wait_for_action = wait_for_action

        server.stop()
コード例 #3
0
    def test_start_cmd(self):
        # Fails on win - see https://bugs.webkit.org/show_bug.cgi?id=84726
        if sys.platform in ('cygwin', 'win32'):
            return

        host = MockHost()
        test_port = test.TestPort(host)
        test_port._path_to_crash_service = lambda: "/mock/crash_service"

        server = CrashService(test_port, "/mock/crash_dumps_dir")
        self.assertRaises(ServerError, server.start)