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