| 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 |
| 11 import run_tests_helper | 11 import run_tests_helper |
| 12 from test_package_apk import TestPackageApk |
| 12 from test_package_executable import TestPackageExecutable | 13 from test_package_executable import TestPackageExecutable |
| 13 from test_result import TestResults | 14 from test_result import TestResults |
| 14 | 15 |
| 15 | 16 |
| 16 class SingleTestRunner(BaseTestRunner): | 17 class SingleTestRunner(BaseTestRunner): |
| 17 """Single test suite attached to a single device. | 18 """Single test suite attached to a single device. |
| 18 | 19 |
| 19 Args: | 20 Args: |
| 20 device: Device to run the tests. | 21 device: Device to run the tests. |
| 21 test_suite: A specific test suite to run, empty to run all. | 22 test_suite: A specific test suite to run, empty to run all. |
| (...skipping 17 matching lines...) Expand all Loading... |
| 39 self._gtest_filter = gtest_filter | 40 self._gtest_filter = gtest_filter |
| 40 self._test_arguments = test_arguments | 41 self._test_arguments = test_arguments |
| 41 self.test_results = TestResults() | 42 self.test_results = TestResults() |
| 42 if dump_debug_info: | 43 if dump_debug_info: |
| 43 self.dump_debug_info = debug_info.GTestDebugInfo(self.adb, device, | 44 self.dump_debug_info = debug_info.GTestDebugInfo(self.adb, device, |
| 44 os.path.basename(test_suite), gtest_filter) | 45 os.path.basename(test_suite), gtest_filter) |
| 45 else: | 46 else: |
| 46 self.dump_debug_info = None | 47 self.dump_debug_info = None |
| 47 self.fast_and_loose = fast_and_loose | 48 self.fast_and_loose = fast_and_loose |
| 48 | 49 |
| 49 self.test_package = TestPackageExecutable(self.adb, device, | 50 if os.path.splitext(test_suite)[1] == '.apk': |
| 51 self.test_package = TestPackageApk(self.adb, device, |
| 52 test_suite, timeout, rebaseline, performance_test, cleanup_test_files, |
| 53 tool, self.dump_debug_info) |
| 54 else: |
| 55 android_product_out = '.' # os.environ['ANDROID_PRODUCT_OUT'] |
| 56 symbols_dir = os.path.join(android_product_out, 'symbols', 'data', |
| 57 'local') |
| 58 self.test_package = TestPackageExecutable(self.adb, device, |
| 50 test_suite, timeout, rebaseline, performance_test, cleanup_test_files, | 59 test_suite, timeout, rebaseline, performance_test, cleanup_test_files, |
| 51 tool, self.dump_debug_info) | 60 tool, self.dump_debug_info) |
| 52 | 61 |
| 53 def _GetHttpServerDocumentRootForTestSuite(self): | 62 def _GetHttpServerDocumentRootForTestSuite(self): |
| 54 """Returns the document root needed by the test suite.""" | 63 """Returns the document root needed by the test suite.""" |
| 55 if self.test_package.test_suite_basename == 'page_cycler_tests': | 64 if self.test_package.test_suite_basename == 'page_cycler_tests': |
| 56 return os.path.join(run_tests_helper.CHROME_DIR, 'data', 'page_cycler') | 65 return os.path.join(run_tests_helper.CHROME_DIR, 'data', 'page_cycler') |
| 57 return None | 66 return None |
| 58 | 67 |
| 59 | 68 |
| (...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 299 def TearDown(self): | 308 def TearDown(self): |
| 300 """Cleans up the test enviroment for the test suite.""" | 309 """Cleans up the test enviroment for the test suite.""" |
| 301 self.test_package.tool.CleanUpEnvironment() | 310 self.test_package.tool.CleanUpEnvironment() |
| 302 if self.test_package.cleanup_test_files: | 311 if self.test_package.cleanup_test_files: |
| 303 self.adb.RemovePushedFiles() | 312 self.adb.RemovePushedFiles() |
| 304 if self.dump_debug_info: | 313 if self.dump_debug_info: |
| 305 self.dump_debug_info.StopRecordingLog() | 314 self.dump_debug_info.StopRecordingLog() |
| 306 if self.test_package.performance_test: | 315 if self.test_package.performance_test: |
| 307 self.adb.TearDownPerformanceTest() | 316 self.adb.TearDownPerformanceTest() |
| 308 super(SingleTestRunner, self).TearDown() | 317 super(SingleTestRunner, self).TearDown() |
| OLD | NEW |