| 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 re | 6 import re | 
| 7 import time | 7 import time | 
| 8 | 8 | 
| 9 from devil.android import device_errors | 9 from devil.android import device_errors | 
| 10 from devil.android import flag_changer | 10 from devil.android import flag_changer | 
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 47     r'\s*mCurrentFocus.*Application (Error|Not Responding): (\S+)}') | 47     r'\s*mCurrentFocus.*Application (Error|Not Responding): (\S+)}') | 
| 48 | 48 | 
| 49 | 49 | 
| 50 class LocalDeviceInstrumentationTestRun( | 50 class LocalDeviceInstrumentationTestRun( | 
| 51     local_device_test_run.LocalDeviceTestRun): | 51     local_device_test_run.LocalDeviceTestRun): | 
| 52   def __init__(self, env, test_instance): | 52   def __init__(self, env, test_instance): | 
| 53     super(LocalDeviceInstrumentationTestRun, self).__init__(env, test_instance) | 53     super(LocalDeviceInstrumentationTestRun, self).__init__(env, test_instance) | 
| 54     self._flag_changers = {} | 54     self._flag_changers = {} | 
| 55 | 55 | 
| 56   def TestPackage(self): | 56   def TestPackage(self): | 
| 57     return None | 57     return self._test_instance.suite | 
| 58 | 58 | 
| 59   def SetUp(self): | 59   def SetUp(self): | 
| 60     def substitute_external_storage(d, external_storage): | 60     def substitute_external_storage(d, external_storage): | 
| 61       if not d: | 61       if not d: | 
| 62         return external_storage | 62         return external_storage | 
| 63       elif isinstance(d, list): | 63       elif isinstance(d, list): | 
| 64         return '/'.join(p if p else external_storage for p in d) | 64         return '/'.join(p if p else external_storage for p in d) | 
| 65       else: | 65       else: | 
| 66         return d | 66         return d | 
| 67 | 67 | 
| 68     @local_device_test_run.handle_shard_failures_with( | 68     @local_device_test_run.handle_shard_failures_with( | 
| 69         self._env.BlacklistDevice) | 69         self._env.BlacklistDevice) | 
| 70     def individual_device_set_up(dev, host_device_tuples): | 70     def individual_device_set_up(dev, host_device_tuples): | 
| 71       def install_apk(): | 71       def install_apk(): | 
| 72         if self._test_instance.apk_under_test_incremental_install_script: | 72         if self._test_instance.apk_under_test: | 
| 73           local_device_test_run.IncrementalInstall( | 73           if self._test_instance.apk_under_test_incremental_install_script: | 
| 74               dev, | 74             local_device_test_run.IncrementalInstall( | 
| 75               self._test_instance.apk_under_test, | 75                 dev, | 
| 76               self._test_instance.apk_under_test_incremental_install_script) | 76                 self._test_instance.apk_under_test, | 
| 77         else: | 77                 self._test_instance.apk_under_test_incremental_install_script) | 
| 78           permissions = self._test_instance.apk_under_test.GetPermissions() | 78           else: | 
| 79           dev.Install(self._test_instance.apk_under_test, | 79             permissions = self._test_instance.apk_under_test.GetPermissions() | 
| 80                       permissions=permissions) | 80             dev.Install(self._test_instance.apk_under_test, | 
|  | 81                         permissions=permissions) | 
| 81 | 82 | 
| 82         if self._test_instance.test_apk_incremental_install_script: | 83         if self._test_instance.test_apk_incremental_install_script: | 
| 83           local_device_test_run.IncrementalInstall( | 84           local_device_test_run.IncrementalInstall( | 
| 84               dev, | 85               dev, | 
| 85               self._test_instance.test_apk, | 86               self._test_instance.test_apk, | 
| 86               self._test_instance.test_apk_incremental_install_script) | 87               self._test_instance.test_apk_incremental_install_script) | 
| 87         else: | 88         else: | 
| 88           permissions = self._test_instance.test_apk.GetPermissions() | 89           permissions = self._test_instance.test_apk.GetPermissions() | 
| 89           dev.Install(self._test_instance.test_apk, permissions=permissions) | 90           dev.Install(self._test_instance.test_apk, permissions=permissions) | 
| 90 | 91 | 
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 283         timeout = v | 284         timeout = v | 
| 284         break | 285         break | 
| 285     else: | 286     else: | 
| 286       logging.warning('Using default 1 minute timeout for %s', test_name) | 287       logging.warning('Using default 1 minute timeout for %s', test_name) | 
| 287       timeout = 60 | 288       timeout = 60 | 
| 288 | 289 | 
| 289     timeout *= cls._GetTimeoutScaleFromAnnotations(annotations) | 290     timeout *= cls._GetTimeoutScaleFromAnnotations(annotations) | 
| 290 | 291 | 
| 291     return timeout | 292     return timeout | 
| 292 | 293 | 
| OLD | NEW | 
|---|