| OLD | NEW |
| 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 posixpath | 7 import posixpath |
| 8 import re | 8 import re |
| 9 import time | 9 import time |
| 10 | 10 |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 def __init__(self, env, test_instance): | 59 def __init__(self, env, test_instance): |
| 60 super(LocalDeviceInstrumentationTestRun, self).__init__(env, test_instance) | 60 super(LocalDeviceInstrumentationTestRun, self).__init__(env, test_instance) |
| 61 self._flag_changers = {} | 61 self._flag_changers = {} |
| 62 | 62 |
| 63 #override | 63 #override |
| 64 def TestPackage(self): | 64 def TestPackage(self): |
| 65 return self._test_instance.suite | 65 return self._test_instance.suite |
| 66 | 66 |
| 67 #override | 67 #override |
| 68 def SetUp(self): | 68 def SetUp(self): |
| 69 def substitute_device_root(d, device_root): |
| 70 if not d: |
| 71 return device_root |
| 72 elif isinstance(d, list): |
| 73 return posixpath.join(*(p if p else device_root for p in d)) |
| 74 else: |
| 75 return d |
| 76 |
| 69 @local_device_environment.handle_shard_failures_with( | 77 @local_device_environment.handle_shard_failures_with( |
| 70 self._env.BlacklistDevice) | 78 self._env.BlacklistDevice) |
| 71 def individual_device_set_up(dev, host_device_tuples): | 79 def individual_device_set_up(dev, host_device_tuples): |
| 72 def install_apk(): | 80 def install_apk(): |
| 73 if self._test_instance.apk_under_test: | 81 if self._test_instance.apk_under_test: |
| 74 if self._test_instance.apk_under_test_incremental_install_script: | 82 if self._test_instance.apk_under_test_incremental_install_script: |
| 75 local_device_test_run.IncrementalInstall( | 83 local_device_test_run.IncrementalInstall( |
| 76 dev, | 84 dev, |
| 77 self._test_instance.apk_under_test, | 85 self._test_instance.apk_under_test, |
| 78 self._test_instance.apk_under_test_incremental_install_script) | 86 self._test_instance.apk_under_test_incremental_install_script) |
| (...skipping 23 matching lines...) Expand all Loading... |
| 102 logging.error("Couldn't set debug app: no package defined") | 110 logging.error("Couldn't set debug app: no package defined") |
| 103 else: | 111 else: |
| 104 dev.RunShellCommand(['am', 'set-debug-app', '--persistent', | 112 dev.RunShellCommand(['am', 'set-debug-app', '--persistent', |
| 105 self._test_instance.package_info.package], | 113 self._test_instance.package_info.package], |
| 106 check_return=True) | 114 check_return=True) |
| 107 | 115 |
| 108 def push_test_data(): | 116 def push_test_data(): |
| 109 device_root = posixpath.join(dev.GetExternalStoragePath(), | 117 device_root = posixpath.join(dev.GetExternalStoragePath(), |
| 110 'chromium_tests_root') | 118 'chromium_tests_root') |
| 111 host_device_tuples_substituted = [ | 119 host_device_tuples_substituted = [ |
| 112 (h, local_device_test_run.SubstituteDeviceRoot(d, device_root)) | 120 (h, substitute_device_root(d, device_root)) |
| 113 for h, d in host_device_tuples] | 121 for h, d in host_device_tuples] |
| 114 logging.info('instrumentation data deps:') | 122 logging.info('instrumentation data deps:') |
| 115 for h, d in host_device_tuples_substituted: | 123 for h, d in host_device_tuples_substituted: |
| 116 logging.info('%r -> %r', h, d) | 124 logging.info('%r -> %r', h, d) |
| 117 dev.PushChangedFiles(host_device_tuples_substituted, | 125 dev.PushChangedFiles(host_device_tuples_substituted, |
| 118 delete_device_stale=True) | 126 delete_device_stale=True) |
| 119 if not host_device_tuples_substituted: | 127 if not host_device_tuples_substituted: |
| 120 dev.RunShellCommand(['rm', '-rf', device_root], check_return=True) | 128 dev.RunShellCommand(['rm', '-rf', device_root], check_return=True) |
| 121 dev.RunShellCommand(['mkdir', '-p', device_root], check_return=True) | 129 dev.RunShellCommand(['mkdir', '-p', device_root], check_return=True) |
| 122 | 130 |
| (...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 366 timeout = v | 374 timeout = v |
| 367 break | 375 break |
| 368 else: | 376 else: |
| 369 logging.warning('Using default 1 minute timeout for %s', test_name) | 377 logging.warning('Using default 1 minute timeout for %s', test_name) |
| 370 timeout = 60 | 378 timeout = 60 |
| 371 | 379 |
| 372 timeout *= cls._GetTimeoutScaleFromAnnotations(annotations) | 380 timeout *= cls._GetTimeoutScaleFromAnnotations(annotations) |
| 373 | 381 |
| 374 return timeout | 382 return timeout |
| 375 | 383 |
| OLD | NEW |