OLD | NEW |
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 import logging | 5 import logging |
6 import os | 6 import os |
7 import sys | 7 import sys |
8 | 8 |
9 from base_test_runner import BaseTestRunner | 9 from base_test_runner import BaseTestRunner |
10 import debug_info | 10 import debug_info |
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
285 if not self._gtest_filter: | 285 if not self._gtest_filter: |
286 self._gtest_filter = ('-' + ':'.join(self.GetDisabledTests()) + ':' + | 286 self._gtest_filter = ('-' + ':'.join(self.GetDisabledTests()) + ':' + |
287 ':'.join(['*.' + x + '*' for x in | 287 ':'.join(['*.' + x + '*' for x in |
288 self.test_package.GetDisabledPrefixes()])) | 288 self.test_package.GetDisabledPrefixes()])) |
289 self.RunTestsWithFilter() | 289 self.RunTestsWithFilter() |
290 return self.test_results | 290 return self.test_results |
291 | 291 |
292 def SetUp(self): | 292 def SetUp(self): |
293 """Sets up necessary test enviroment for the test suite.""" | 293 """Sets up necessary test enviroment for the test suite.""" |
294 super(SingleTestRunner, self).SetUp() | 294 super(SingleTestRunner, self).SetUp() |
| 295 # Sometimes adb server lost connection to the emulator, which will break |
| 296 # the test, so restart the adb server before the test. |
| 297 self.adb.Adb().RestartAdbServer() |
295 if self.test_package.performance_test: | 298 if self.test_package.performance_test: |
296 if run_tests_helper.IsRunningAsBuildbot(): | 299 if run_tests_helper.IsRunningAsBuildbot(): |
297 self.adb.SetJavaAssertsEnabled(enable=False) | 300 self.adb.SetJavaAssertsEnabled(enable=False) |
298 self.adb.Reboot(full_reboot=False) | 301 self.adb.Reboot(full_reboot=False) |
299 self.adb.SetupPerformanceTest() | 302 self.adb.SetupPerformanceTest() |
300 if self.dump_debug_info: | 303 if self.dump_debug_info: |
301 self.dump_debug_info.StartRecordingLog(True) | 304 self.dump_debug_info.StartRecordingLog(True) |
302 self.StripAndCopyFiles() | 305 self.StripAndCopyFiles() |
303 self.LaunchHelperToolsForTestSuite() | 306 self.LaunchHelperToolsForTestSuite() |
304 self.test_package.tool.SetupEnvironment() | 307 self.test_package.tool.SetupEnvironment() |
305 | 308 |
306 def TearDown(self): | 309 def TearDown(self): |
307 """Cleans up the test enviroment for the test suite.""" | 310 """Cleans up the test enviroment for the test suite.""" |
308 self.test_package.tool.CleanUpEnvironment() | 311 self.test_package.tool.CleanUpEnvironment() |
309 if self.test_package.cleanup_test_files: | 312 if self.test_package.cleanup_test_files: |
310 self.adb.RemovePushedFiles() | 313 self.adb.RemovePushedFiles() |
311 if self.dump_debug_info: | 314 if self.dump_debug_info: |
312 self.dump_debug_info.StopRecordingLog() | 315 self.dump_debug_info.StopRecordingLog() |
313 if self.test_package.performance_test: | 316 if self.test_package.performance_test: |
314 self.adb.TearDownPerformanceTest() | 317 self.adb.TearDownPerformanceTest() |
315 super(SingleTestRunner, self).TearDown() | 318 super(SingleTestRunner, self).TearDown() |
OLD | NEW |