OLD | NEW |
1 # Copyright (C) 2010 Google Inc. All rights reserved. | 1 # Copyright (C) 2010 Google Inc. All rights reserved. |
2 # Copyright (C) 2010 Gabor Rapcsanyi (rgabor@inf.u-szeged.hu), University of Sze
ged | 2 # Copyright (C) 2010 Gabor Rapcsanyi (rgabor@inf.u-szeged.hu), University of Sze
ged |
3 # | 3 # |
4 # Redistribution and use in source and binary forms, with or without | 4 # Redistribution and use in source and binary forms, with or without |
5 # modification, are permitted provided that the following conditions are | 5 # modification, are permitted provided that the following conditions are |
6 # met: | 6 # met: |
7 # | 7 # |
8 # * Redistributions of source code must retain the above copyright | 8 # * Redistributions of source code must retain the above copyright |
9 # notice, this list of conditions and the following disclaimer. | 9 # notice, this list of conditions and the following disclaimer. |
10 # * Redistributions in binary form must reproduce the above | 10 # * Redistributions in binary form must reproduce the above |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 manager = get_manager() | 68 manager = get_manager() |
69 self.assertTrue(manager.needs_servers(['http/tests/mime'])) | 69 self.assertTrue(manager.needs_servers(['http/tests/mime'])) |
70 | 70 |
71 if sys.platform == 'win32': | 71 if sys.platform == 'win32': |
72 manager = get_manager() | 72 manager = get_manager() |
73 self.assertFalse(manager.needs_servers(['fast\\html'])) | 73 self.assertFalse(manager.needs_servers(['fast\\html'])) |
74 | 74 |
75 manager = get_manager() | 75 manager = get_manager() |
76 self.assertTrue(manager.needs_servers(['http\\tests\\mime'])) | 76 self.assertTrue(manager.needs_servers(['http\\tests\\mime'])) |
77 | 77 |
| 78 def test_servers_started(self): |
| 79 def get_manager(port): |
| 80 manager = Manager(port, options=MockOptions(http=True, max_locked_sh
ards=1), printer=Mock()) |
| 81 return manager |
| 82 |
| 83 def start_http_server(number_of_servers=None): |
| 84 self.http_started = True |
| 85 |
| 86 def start_websocket_server(): |
| 87 self.websocket_started = True |
| 88 |
| 89 def stop_http_server(): |
| 90 self.http_stopped = True |
| 91 |
| 92 def stop_websocket_server(): |
| 93 self.websocket_stopped = True |
| 94 |
| 95 host = MockHost() |
| 96 port = host.port_factory.get('test-mac-leopard') |
| 97 port.start_http_server = start_http_server |
| 98 port.start_websocket_server = start_websocket_server |
| 99 port.stop_http_server = stop_http_server |
| 100 port.stop_websocket_server = stop_websocket_server |
| 101 |
| 102 self.http_started = self.http_stopped = self.websocket_started = self.we
bsocket_stopped = False |
| 103 manager = get_manager(port) |
| 104 manager._start_servers(['http/tests/foo.html']) |
| 105 self.assertEqual(self.http_started, True) |
| 106 self.assertEqual(self.websocket_started, False) |
| 107 manager._stop_servers() |
| 108 self.assertEqual(self.http_stopped, True) |
| 109 self.assertEqual(self.websocket_stopped, False) |
| 110 |
| 111 self.http_started = self.http_stopped = self.websocket_started = self.we
bsocket_stopped = False |
| 112 manager._start_servers(['http/tests/websocket/foo.html']) |
| 113 self.assertEqual(self.http_started, True) |
| 114 self.assertEqual(self.websocket_started, True) |
| 115 manager._stop_servers() |
| 116 self.assertEqual(self.http_stopped, True) |
| 117 self.assertEqual(self.websocket_stopped, True) |
| 118 |
| 119 self.http_started = self.http_stopped = self.websocket_started = self.we
bsocket_stopped = False |
| 120 manager._start_servers(['fast/html/foo.html']) |
| 121 self.assertEqual(self.http_started, False) |
| 122 self.assertEqual(self.websocket_started, False) |
| 123 manager._stop_servers() |
| 124 self.assertEqual(self.http_stopped, False) |
| 125 self.assertEqual(self.websocket_stopped, False) |
| 126 |
| 127 |
78 def test_look_for_new_crash_logs(self): | 128 def test_look_for_new_crash_logs(self): |
79 def get_manager(): | 129 def get_manager(): |
80 host = MockHost() | 130 host = MockHost() |
81 port = host.port_factory.get('test-mac-leopard') | 131 port = host.port_factory.get('test-mac-leopard') |
82 manager = Manager(port, options=MockOptions(test_list=None, http=Tru
e, max_locked_shards=1), printer=Mock()) | 132 manager = Manager(port, options=MockOptions(test_list=None, http=Tru
e, max_locked_shards=1), printer=Mock()) |
83 return manager | 133 return manager |
84 host = MockHost() | 134 host = MockHost() |
85 port = host.port_factory.get('test-mac-leopard') | 135 port = host.port_factory.get('test-mac-leopard') |
86 tests = ['failures/expected/crash.html'] | 136 tests = ['failures/expected/crash.html'] |
87 expectations = test_expectations.TestExpectations(port, tests) | 137 expectations = test_expectations.TestExpectations(port, tests) |
88 run_results = TestRunResults(expectations, len(tests)) | 138 run_results = TestRunResults(expectations, len(tests)) |
89 manager = get_manager() | 139 manager = get_manager() |
90 manager._look_for_new_crash_logs(run_results, time.time()) | 140 manager._look_for_new_crash_logs(run_results, time.time()) |
OLD | NEW |