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