| 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._check_for_leak(error_line), 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 |
| 168 driver._leaked = False |
| 167 assert_crash(driver, '#CRASHED\n', True, 'FakeServerProcess', 1234) | 169 assert_crash(driver, '#CRASHED\n', True, 'FakeServerProcess', 1234) |
| 168 | 170 |
| 169 driver._crashed_process_name = None | 171 driver._crashed_process_name = None |
| 170 driver._crashed_pid = None | 172 driver._crashed_pid = None |
| 171 driver._server_process = FakeServerProcess(False) | 173 driver._server_process = FakeServerProcess(False) |
| 172 driver._subprocess_was_unresponsive = False | 174 driver._subprocess_was_unresponsive = False |
| 175 driver._leaked = False |
| 173 assert_crash(driver, '#CRASHED - WebProcess\n', True, 'WebProcess', None
) | 176 assert_crash(driver, '#CRASHED - WebProcess\n', True, 'WebProcess', None
) |
| 174 | 177 |
| 175 driver._crashed_process_name = None | 178 driver._crashed_process_name = None |
| 176 driver._crashed_pid = None | 179 driver._crashed_pid = None |
| 177 driver._server_process = FakeServerProcess(False) | 180 driver._server_process = FakeServerProcess(False) |
| 178 driver._subprocess_was_unresponsive = False | 181 driver._subprocess_was_unresponsive = False |
| 182 driver._leaked = False |
| 179 assert_crash(driver, '#CRASHED - WebProcess (pid 8675)\n', True, 'WebPro
cess', 8675) | 183 assert_crash(driver, '#CRASHED - WebProcess (pid 8675)\n', True, 'WebPro
cess', 8675) |
| 180 | 184 |
| 181 driver._crashed_process_name = None | 185 driver._crashed_process_name = None |
| 182 driver._crashed_pid = None | 186 driver._crashed_pid = None |
| 183 driver._server_process = FakeServerProcess(False) | 187 driver._server_process = FakeServerProcess(False) |
| 184 driver._subprocess_was_unresponsive = False | 188 driver._subprocess_was_unresponsive = False |
| 189 driver._leaked = False |
| 185 assert_crash(driver, '#PROCESS UNRESPONSIVE - WebProcess (pid 8675)\n',
True, 'WebProcess', 8675, True) | 190 assert_crash(driver, '#PROCESS UNRESPONSIVE - WebProcess (pid 8675)\n',
True, 'WebProcess', 8675, True) |
| 186 | 191 |
| 187 driver._crashed_process_name = None | 192 driver._crashed_process_name = None |
| 188 driver._crashed_pid = None | 193 driver._crashed_pid = None |
| 189 driver._server_process = FakeServerProcess(False) | 194 driver._server_process = FakeServerProcess(False) |
| 190 driver._subprocess_was_unresponsive = False | 195 driver._subprocess_was_unresponsive = False |
| 196 driver._leaked = False |
| 191 assert_crash(driver, '#CRASHED - renderer (pid 8675)\n', True, 'renderer
', 8675) | 197 assert_crash(driver, '#CRASHED - renderer (pid 8675)\n', True, 'renderer
', 8675) |
| 192 | 198 |
| 193 driver._crashed_process_name = None | 199 driver._crashed_process_name = None |
| 194 driver._crashed_pid = None | 200 driver._crashed_pid = None |
| 201 driver._server_process = FakeServerProcess(False) |
| 202 driver._subprocess_was_unresponsive = False |
| 203 driver._leaked = False |
| 204 assert_crash(driver, '#LEAK - renderer pid 8675 ({"numberOfLiveDocuments
":[2,3]})\n', False, None, None, False, True) |
| 205 |
| 206 driver._crashed_process_name = None |
| 207 driver._crashed_pid = None |
| 195 driver._server_process = FakeServerProcess(True) | 208 driver._server_process = FakeServerProcess(True) |
| 196 driver._subprocess_was_unresponsive = False | 209 driver._subprocess_was_unresponsive = False |
| 210 driver._leaked = False |
| 197 assert_crash(driver, '', True, 'FakeServerProcess', 1234) | 211 assert_crash(driver, '', True, 'FakeServerProcess', 1234) |
| 198 | 212 |
| 199 def test_creating_a_port_does_not_write_to_the_filesystem(self): | 213 def test_creating_a_port_does_not_write_to_the_filesystem(self): |
| 200 port = TestWebKitPort() | 214 port = TestWebKitPort() |
| 201 driver = Driver(port, 0, pixel_tests=True) | 215 driver = Driver(port, 0, pixel_tests=True) |
| 202 self.assertEqual(port._filesystem.written_files, {}) | 216 self.assertEqual(port._filesystem.written_files, {}) |
| 203 self.assertEqual(port._filesystem.last_tmpdir, None) | 217 self.assertEqual(port._filesystem.last_tmpdir, None) |
| 204 | 218 |
| 205 def test_stop_cleans_up_properly(self): | 219 def test_stop_cleans_up_properly(self): |
| 206 port = TestWebKitPort() | 220 port = TestWebKitPort() |
| (...skipping 13 matching lines...) Expand all Loading... |
| 220 last_tmpdir = port._filesystem.last_tmpdir | 234 last_tmpdir = port._filesystem.last_tmpdir |
| 221 driver._start(True, []) | 235 driver._start(True, []) |
| 222 self.assertFalse(port._filesystem.isdir(last_tmpdir)) | 236 self.assertFalse(port._filesystem.isdir(last_tmpdir)) |
| 223 | 237 |
| 224 def test_start_actually_starts(self): | 238 def test_start_actually_starts(self): |
| 225 port = TestWebKitPort() | 239 port = TestWebKitPort() |
| 226 port._server_process_constructor = MockServerProcess | 240 port._server_process_constructor = MockServerProcess |
| 227 driver = Driver(port, 0, pixel_tests=True) | 241 driver = Driver(port, 0, pixel_tests=True) |
| 228 driver.start(True, []) | 242 driver.start(True, []) |
| 229 self.assertTrue(driver._server_process.started) | 243 self.assertTrue(driver._server_process.started) |
| OLD | NEW |