Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(171)

Side by Side Diff: Tools/Scripts/webkitpy/layout_tests/servers/crash_service_unittest.py

Issue 546133003: Reformat webkitpy.layout_tests w/ format-webkitpy. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 # Copyright (C) 2013 Google Inc. All rights reserved. 1 # Copyright (C) 2013 Google Inc. All rights reserved.
2 # 2 #
3 # Redistribution and use in source and binary forms, with or without 3 # Redistribution and use in source and binary forms, with or without
4 # modification, are permitted provided that the following conditions are 4 # modification, are permitted provided that the following conditions are
5 # met: 5 # met:
6 # 6 #
7 # * Redistributions of source code must retain the above copyright 7 # * Redistributions of source code must retain the above copyright
8 # notice, this list of conditions and the following disclaimer. 8 # notice, this list of conditions and the following disclaimer.
9 # * Redistributions in binary form must reproduce the above 9 # * Redistributions in binary form must reproduce the above
10 # copyright notice, this list of conditions and the following disclaimer 10 # copyright notice, this list of conditions and the following disclaimer
(...skipping 19 matching lines...) Expand all
30 import sys 30 import sys
31 import unittest 31 import unittest
32 32
33 from webkitpy.common.host_mock import MockHost 33 from webkitpy.common.host_mock import MockHost
34 from webkitpy.layout_tests.port import test 34 from webkitpy.layout_tests.port import test
35 from webkitpy.layout_tests.servers.crash_service import CrashService 35 from webkitpy.layout_tests.servers.crash_service import CrashService
36 from webkitpy.layout_tests.servers.server_base import ServerError 36 from webkitpy.layout_tests.servers.server_base import ServerError
37 37
38 38
39 class TestCrashService(unittest.TestCase): 39 class TestCrashService(unittest.TestCase):
40
40 def test_start_cmd(self): 41 def test_start_cmd(self):
41 # Fails on win - see https://bugs.webkit.org/show_bug.cgi?id=84726 42 # Fails on win - see https://bugs.webkit.org/show_bug.cgi?id=84726
42 if sys.platform in ('cygwin', 'win32'): 43 if sys.platform in ('cygwin', 'win32'):
43 return 44 return
44 45
45 host = MockHost() 46 host = MockHost()
46 test_port = test.TestPort(host) 47 test_port = test.TestPort(host)
47 test_port._path_to_crash_service = lambda: "/mock/crash_service" 48 test_port._path_to_crash_service = lambda: '/mock/crash_service'
48 49
49 server = CrashService(test_port, "/mock/crash_dumps_dir") 50 server = CrashService(test_port, '/mock/crash_dumps_dir')
50 self.assertRaises(ServerError, server.start) 51 self.assertRaises(ServerError, server.start)
51 52
52 def test_win32_start_and_stop(self): 53 def test_win32_start_and_stop(self):
53 host = MockHost() 54 host = MockHost()
54 test_port = test.TestPort(host) 55 test_port = test.TestPort(host)
55 test_port._path_to_crash_service = lambda: "/mock/crash_service" 56 test_port._path_to_crash_service = lambda: '/mock/crash_service'
56 57
57 host.platform.is_win = lambda: True 58 host.platform.is_win = lambda: True
58 host.platform.is_cygwin = lambda: False 59 host.platform.is_cygwin = lambda: False
59 60
60 server = CrashService(test_port, "/mock/crash_dumps_dir") 61 server = CrashService(test_port, '/mock/crash_dumps_dir')
61 server._check_that_all_ports_are_available = lambda: True 62 server._check_that_all_ports_are_available = lambda: True
62 server._is_server_running_on_all_ports = lambda: True 63 server._is_server_running_on_all_ports = lambda: True
63 64
64 server.start() 65 server.start()
65 self.assertNotEquals(host.executive.calls, []) 66 self.assertNotEquals(host.executive.calls, [])
66 67
67 def wait_for_action(action): 68 def wait_for_action(action):
68 if action(): 69 if action():
69 return True 70 return True
70 return action() 71 return action()
71 72
72 def mock_returns(return_values): 73 def mock_returns(return_values):
73 def return_value_thunk(*args, **kwargs): 74 def return_value_thunk(*args, **kwargs):
74 return return_values.pop(0) 75 return return_values.pop(0)
75 return return_value_thunk 76 return return_value_thunk
76 77
77 host.executive.check_running_pid = mock_returns([True, False]) 78 host.executive.check_running_pid = mock_returns([True, False])
78 server._wait_for_action = wait_for_action 79 server._wait_for_action = wait_for_action
79 80
80 server.stop() 81 server.stop()
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698