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

Side by Side Diff: build/android/pylib/instrumentation/instrumentation_test_instance.py

Issue 1143903002: [Android] Refactor the native test wrappers. (RELAND) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 5 years, 7 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 | « build/android/pylib/gtest/test_runner.py ('k') | build/android/pylib/utils/apk_helper.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 2015 The Chromium Authors. All rights reserved. 1 # Copyright 2015 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 pickle 7 import pickle
8 import re 8 import re
9 import sys 9 import sys
10 10
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 '%s.jar' % self._suite) 194 '%s.jar' % self._suite)
195 self._test_support_apk = os.path.join( 195 self._test_support_apk = os.path.join(
196 constants.GetOutDirectory(), constants.SDK_BUILD_TEST_JAVALIB_DIR, 196 constants.GetOutDirectory(), constants.SDK_BUILD_TEST_JAVALIB_DIR,
197 '%sSupport.apk' % self._suite) 197 '%sSupport.apk' % self._suite)
198 198
199 if not os.path.exists(self._test_apk): 199 if not os.path.exists(self._test_apk):
200 error_func('Unable to find test APK: %s' % self._test_apk) 200 error_func('Unable to find test APK: %s' % self._test_apk)
201 if not os.path.exists(self._test_jar): 201 if not os.path.exists(self._test_jar):
202 error_func('Unable to find test JAR: %s' % self._test_jar) 202 error_func('Unable to find test JAR: %s' % self._test_jar)
203 203
204 self._test_package = apk_helper.GetPackageName(self.test_apk) 204 apk = apk_helper.ApkHelper(self.test_apk)
205 self._test_runner = apk_helper.GetInstrumentationName(self.test_apk) 205 self._test_package = apk.GetPackageName()
206 self._test_runner = apk.GetInstrumentationName()
206 207
207 self._package_info = None 208 self._package_info = None
208 for package_info in constants.PACKAGE_INFO.itervalues(): 209 for package_info in constants.PACKAGE_INFO.itervalues():
209 if self._test_package == package_info.test_package: 210 if self._test_package == package_info.test_package:
210 self._package_info = package_info 211 self._package_info = package_info
211 if not self._package_info: 212 if not self._package_info:
212 logging.warning('Unable to find package info for %s', self._test_package) 213 logging.warning('Unable to find package info for %s', self._test_package)
213 214
214 def _initializeDataDependencyAttributes(self, args, isolate_delegate): 215 def _initializeDataDependencyAttributes(self, args, isolate_delegate):
215 self._data_deps = [] 216 self._data_deps = []
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 if hasattr(args, 'device_flags_file') and args.device_flags_file: 268 if hasattr(args, 'device_flags_file') and args.device_flags_file:
268 with open(args.device_flags_file) as device_flags_file: 269 with open(args.device_flags_file) as device_flags_file:
269 stripped_lines = (l.strip() for l in device_flags_file) 270 stripped_lines = (l.strip() for l in device_flags_file)
270 self._flags.extend([flag for flag in stripped_lines if flag]) 271 self._flags.extend([flag for flag in stripped_lines if flag])
271 272
272 def _initializeDriverAttributes(self): 273 def _initializeDriverAttributes(self):
273 self._driver_apk = os.path.join( 274 self._driver_apk = os.path.join(
274 constants.GetOutDirectory(), constants.SDK_BUILD_APKS_DIR, 275 constants.GetOutDirectory(), constants.SDK_BUILD_APKS_DIR,
275 'OnDeviceInstrumentationDriver.apk') 276 'OnDeviceInstrumentationDriver.apk')
276 if os.path.exists(self._driver_apk): 277 if os.path.exists(self._driver_apk):
277 self._driver_package = apk_helper.GetPackageName( 278 driver_apk = apk_helper.ApkHelper(self._driver_apk)
278 self._driver_apk) 279 self._driver_package = driver_apk.GetPackageName()
279 self._driver_name = apk_helper.GetInstrumentationName( 280 self._driver_name = driver_apk.GetInstrumentationName()
280 self._driver_apk)
281 else: 281 else:
282 self._driver_apk = None 282 self._driver_apk = None
283 283
284 @property 284 @property
285 def apk_under_test(self): 285 def apk_under_test(self):
286 return self._apk_under_test 286 return self._apk_under_test
287 287
288 @property 288 @property
289 def flags(self): 289 def flags(self):
290 return self._flags 290 return self._flags
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
516 def GenerateTestResults( 516 def GenerateTestResults(
517 result_code, result_bundle, statuses, start_ms, duration_ms): 517 result_code, result_bundle, statuses, start_ms, duration_ms):
518 return GenerateTestResults(result_code, result_bundle, statuses, 518 return GenerateTestResults(result_code, result_bundle, statuses,
519 start_ms, duration_ms) 519 start_ms, duration_ms)
520 520
521 #override 521 #override
522 def TearDown(self): 522 def TearDown(self):
523 if self._isolate_delegate: 523 if self._isolate_delegate:
524 self._isolate_delegate.Clear() 524 self._isolate_delegate.Clear()
525 525
OLDNEW
« no previous file with comments | « build/android/pylib/gtest/test_runner.py ('k') | build/android/pylib/utils/apk_helper.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698