Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(333)

Side by Side Diff: build/android/pylib/host_driven/test_case.py

Issue 163923002: [Android] Lint pylib/instrumentation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | build/android/pylib/instrumentation/json_perf_parser.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « no previous file | build/android/pylib/instrumentation/json_perf_parser.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698