| OLD | NEW |
| 1 # Copyright 2013 The Chromium Authors. All rights reserved. | 1 # Copyright 2013 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 """Base class for host-driven test cases. | 5 """Base class for host-driven test cases. |
| 6 | 6 |
| 7 This test case is intended to serve as the base class for any host-driven | 7 This test case is intended to serve as the base class for any host-driven |
| 8 test cases. It is similar to the Python unitttest module in that test cases | 8 test cases. It is similar to the Python unitttest module in that test cases |
| 9 inherit from this class and add methods which will be run as tests. | 9 inherit from this class and add methods which will be run as tests. |
| 10 | 10 |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 | 150 |
| 151 Returns: | 151 Returns: |
| 152 A TestRunResults object containing an overall result for this set of Java | 152 A TestRunResults object containing an overall result for this set of Java |
| 153 tests. If any Java tests do not pass, this is a fail overall. | 153 tests. If any Java tests do not pass, this is a fail overall. |
| 154 """ | 154 """ |
| 155 test_type = base_test_result.ResultType.PASS | 155 test_type = base_test_result.ResultType.PASS |
| 156 log = '' | 156 log = '' |
| 157 | 157 |
| 158 test_pkg = test_package.TestPackage( | 158 test_pkg = test_package.TestPackage( |
| 159 self.instrumentation_options.test_apk_path, | 159 self.instrumentation_options.test_apk_path, |
| 160 self.instrumentation_options.test_apk_jar_path) | 160 self.instrumentation_options.test_apk_jar_path, |
| 161 self.instrumentation_options.test_support_apk_path) |
| 161 | 162 |
| 162 start_ms = int(time.time()) * 1000 | 163 start_ms = int(time.time()) * 1000 |
| 163 done = False | 164 done = False |
| 164 for test_filter in test_filters: | 165 for test_filter in test_filters: |
| 165 tests = test_pkg.GetAllMatchingTests(None, None, test_filter) | 166 tests = test_pkg.GetAllMatchingTests(None, None, test_filter) |
| 166 # Filters should always result in >= 1 test. | 167 # Filters should always result in >= 1 test. |
| 167 if len(tests) == 0: | 168 if len(tests) == 0: |
| 168 raise Exception('Java test filter "%s" returned no tests.' | 169 raise Exception('Java test filter "%s" returned no tests.' |
| 169 % test_filter) | 170 % test_filter) |
| 170 for test in tests: | 171 for test in tests: |
| (...skipping 16 matching lines...) Expand all Loading... |
| 187 overall_result.AddResult( | 188 overall_result.AddResult( |
| 188 test_result.InstrumentationTestResult( | 189 test_result.InstrumentationTestResult( |
| 189 self.tagged_name, test_type, start_ms, duration_ms, log=log)) | 190 self.tagged_name, test_type, start_ms, duration_ms, log=log)) |
| 190 return overall_result | 191 return overall_result |
| 191 | 192 |
| 192 def __str__(self): | 193 def __str__(self): |
| 193 return self.tagged_name | 194 return self.tagged_name |
| 194 | 195 |
| 195 def __repr__(self): | 196 def __repr__(self): |
| 196 return self.tagged_name | 197 return self.tagged_name |
| OLD | NEW |