| 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 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 test_type = base_test_result.ResultType.PASS | 151 test_type = base_test_result.ResultType.PASS |
| 152 log = '' | 152 log = '' |
| 153 | 153 |
| 154 test_pkg = test_package.TestPackage( | 154 test_pkg = test_package.TestPackage( |
| 155 self.instrumentation_options.test_apk_path, | 155 self.instrumentation_options.test_apk_path, |
| 156 self.instrumentation_options.test_apk_jar_path) | 156 self.instrumentation_options.test_apk_jar_path) |
| 157 | 157 |
| 158 start_ms = int(time.time()) * 1000 | 158 start_ms = int(time.time()) * 1000 |
| 159 done = False | 159 done = False |
| 160 for test_filter in test_filters: | 160 for test_filter in test_filters: |
| 161 tests = test_pkg._GetAllMatchingTests(None, None, test_filter) | 161 tests = test_pkg.GetAllMatchingTests(None, None, test_filter) |
| 162 # Filters should always result in >= 1 test. | 162 # Filters should always result in >= 1 test. |
| 163 if len(tests) == 0: | 163 if len(tests) == 0: |
| 164 raise Exception('Java test filter "%s" returned no tests.' | 164 raise Exception('Java test filter "%s" returned no tests.' |
| 165 % test_filter) | 165 % test_filter) |
| 166 for test in tests: | 166 for test in tests: |
| 167 # We're only running one test at a time, so this TestRunResults object | 167 # We're only running one test at a time, so this TestRunResults object |
| 168 # will hold only one result. | 168 # will hold only one result. |
| 169 java_result = self.__RunJavaTest(test, test_pkg, additional_flags) | 169 java_result = self.__RunJavaTest(test, test_pkg, additional_flags) |
| 170 assert len(java_result.GetAll()) == 1 | 170 assert len(java_result.GetAll()) == 1 |
| 171 if not java_result.DidRunPass(): | 171 if not java_result.DidRunPass(): |
| (...skipping 11 matching lines...) Expand all Loading... |
| 183 overall_result.AddResult( | 183 overall_result.AddResult( |
| 184 test_result.InstrumentationTestResult( | 184 test_result.InstrumentationTestResult( |
| 185 self.tagged_name, test_type, start_ms, duration_ms, log=log)) | 185 self.tagged_name, test_type, start_ms, duration_ms, log=log)) |
| 186 return overall_result | 186 return overall_result |
| 187 | 187 |
| 188 def __str__(self): | 188 def __str__(self): |
| 189 return self.tagged_name | 189 return self.tagged_name |
| 190 | 190 |
| 191 def __repr__(self): | 191 def __repr__(self): |
| 192 return self.tagged_name | 192 return self.tagged_name |
| OLD | NEW |