| OLD | NEW |
| 1 # Copyright (C) 2010 Google Inc. All rights reserved. | 1 # Copyright (C) 2010 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 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 | 143 |
| 144 def name(self): | 144 def name(self): |
| 145 return 'FakeServerProcess' | 145 return 'FakeServerProcess' |
| 146 | 146 |
| 147 def has_crashed(self): | 147 def has_crashed(self): |
| 148 return self.crashed | 148 return self.crashed |
| 149 | 149 |
| 150 def stop(self, timeout=0.0): | 150 def stop(self, timeout=0.0): |
| 151 pass | 151 pass |
| 152 | 152 |
| 153 def assert_crash(driver, error_line, crashed, name, pid, unresponsive=Fa
lse): | 153 def assert_crash(driver, error_line, crashed, name, pid, unresponsive=Fa
lse, leaked=False): |
| 154 self.assertEqual(driver._check_for_driver_crash(error_line), crashed
) | 154 self.assertEqual(driver._check_for_driver_crash(error_line), crashed
) |
| 155 self.assertEqual(driver._crashed_process_name, name) | 155 self.assertEqual(driver._crashed_process_name, name) |
| 156 self.assertEqual(driver._crashed_pid, pid) | 156 self.assertEqual(driver._crashed_pid, pid) |
| 157 self.assertEqual(driver._subprocess_was_unresponsive, unresponsive) | 157 self.assertEqual(driver._subprocess_was_unresponsive, unresponsive) |
| 158 self.assertEqual(driver._leaked, leaked) |
| 158 driver.stop() | 159 driver.stop() |
| 159 | 160 |
| 160 driver._server_process = FakeServerProcess(False) | 161 driver._server_process = FakeServerProcess(False) |
| 161 assert_crash(driver, '', False, None, None) | 162 assert_crash(driver, '', False, None, None) |
| 162 | 163 |
| 163 driver._crashed_process_name = None | 164 driver._crashed_process_name = None |
| 164 driver._crashed_pid = None | 165 driver._crashed_pid = None |
| 165 driver._server_process = FakeServerProcess(False) | 166 driver._server_process = FakeServerProcess(False) |
| 166 driver._subprocess_was_unresponsive = False | 167 driver._subprocess_was_unresponsive = False |
| 167 assert_crash(driver, '#CRASHED\n', True, 'FakeServerProcess', 1234) | 168 assert_crash(driver, '#CRASHED\n', True, 'FakeServerProcess', 1234) |
| (...skipping 21 matching lines...) Expand all Loading... |
| 189 driver._server_process = FakeServerProcess(False) | 190 driver._server_process = FakeServerProcess(False) |
| 190 driver._subprocess_was_unresponsive = False | 191 driver._subprocess_was_unresponsive = False |
| 191 assert_crash(driver, '#CRASHED - renderer (pid 8675)\n', True, 'renderer
', 8675) | 192 assert_crash(driver, '#CRASHED - renderer (pid 8675)\n', True, 'renderer
', 8675) |
| 192 | 193 |
| 193 driver._crashed_process_name = None | 194 driver._crashed_process_name = None |
| 194 driver._crashed_pid = None | 195 driver._crashed_pid = None |
| 195 driver._server_process = FakeServerProcess(True) | 196 driver._server_process = FakeServerProcess(True) |
| 196 driver._subprocess_was_unresponsive = False | 197 driver._subprocess_was_unresponsive = False |
| 197 assert_crash(driver, '', True, 'FakeServerProcess', 1234) | 198 assert_crash(driver, '', True, 'FakeServerProcess', 1234) |
| 198 | 199 |
| 200 driver._crashed_process_name = None |
| 201 driver._crashed_pid = None |
| 202 driver._server_process = FakeServerProcess(False) |
| 203 driver._subprocess_was_unresponsive = False |
| 204 assert_crash(driver, '#LEAK - renderer pid 8675 ({"numberOfLiveDocuments
":[2,3]})\n', True, 'renderer', 8675, False, True) |
| 205 |
| 199 def test_creating_a_port_does_not_write_to_the_filesystem(self): | 206 def test_creating_a_port_does_not_write_to_the_filesystem(self): |
| 200 port = TestWebKitPort() | 207 port = TestWebKitPort() |
| 201 driver = Driver(port, 0, pixel_tests=True) | 208 driver = Driver(port, 0, pixel_tests=True) |
| 202 self.assertEqual(port._filesystem.written_files, {}) | 209 self.assertEqual(port._filesystem.written_files, {}) |
| 203 self.assertEqual(port._filesystem.last_tmpdir, None) | 210 self.assertEqual(port._filesystem.last_tmpdir, None) |
| 204 | 211 |
| 205 def test_stop_cleans_up_properly(self): | 212 def test_stop_cleans_up_properly(self): |
| 206 port = TestWebKitPort() | 213 port = TestWebKitPort() |
| 207 port._server_process_constructor = MockServerProcess | 214 port._server_process_constructor = MockServerProcess |
| 208 driver = Driver(port, 0, pixel_tests=True) | 215 driver = Driver(port, 0, pixel_tests=True) |
| (...skipping 11 matching lines...) Expand all Loading... |
| 220 last_tmpdir = port._filesystem.last_tmpdir | 227 last_tmpdir = port._filesystem.last_tmpdir |
| 221 driver._start(True, []) | 228 driver._start(True, []) |
| 222 self.assertFalse(port._filesystem.isdir(last_tmpdir)) | 229 self.assertFalse(port._filesystem.isdir(last_tmpdir)) |
| 223 | 230 |
| 224 def test_start_actually_starts(self): | 231 def test_start_actually_starts(self): |
| 225 port = TestWebKitPort() | 232 port = TestWebKitPort() |
| 226 port._server_process_constructor = MockServerProcess | 233 port._server_process_constructor = MockServerProcess |
| 227 driver = Driver(port, 0, pixel_tests=True) | 234 driver = Driver(port, 0, pixel_tests=True) |
| 228 driver.start(True, []) | 235 driver.start(True, []) |
| 229 self.assertTrue(driver._server_process.started) | 236 self.assertTrue(driver._server_process.started) |
| OLD | NEW |