| 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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 | 55 |
| 56 class LocalDeviceInstrumentationTestRun( | 56 class LocalDeviceInstrumentationTestRun( |
| 57 local_device_test_run.LocalDeviceTestRun): | 57 local_device_test_run.LocalDeviceTestRun): |
| 58 def __init__(self, env, test_instance): | 58 def __init__(self, env, test_instance): |
| 59 super(LocalDeviceInstrumentationTestRun, self).__init__(env, test_instance) | 59 super(LocalDeviceInstrumentationTestRun, self).__init__(env, test_instance) |
| 60 self._flag_changers = {} | 60 self._flag_changers = {} |
| 61 | 61 |
| 62 def TestPackage(self): | 62 def TestPackage(self): |
| 63 return self._test_instance.suite | 63 return self._test_instance.suite |
| 64 | 64 |
| 65 #override |
| 65 def SetUp(self): | 66 def SetUp(self): |
| 66 def substitute_device_root(d, device_root): | 67 def substitute_device_root(d, device_root): |
| 67 if not d: | 68 if not d: |
| 68 return device_root | 69 return device_root |
| 69 elif isinstance(d, list): | 70 elif isinstance(d, list): |
| 70 return posixpath.join(*(p if p else device_root for p in d)) | 71 return posixpath.join(*(p if p else device_root for p in d)) |
| 71 else: | 72 else: |
| 72 return d | 73 return d |
| 73 | 74 |
| 74 @local_device_environment.handle_shard_failures_with( | 75 @local_device_environment.handle_shard_failures_with( |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 else: | 147 else: |
| 147 for step in steps: | 148 for step in steps: |
| 148 step() | 149 step() |
| 149 if self._test_instance.store_tombstones: | 150 if self._test_instance.store_tombstones: |
| 150 tombstones.ClearAllTombstones(dev) | 151 tombstones.ClearAllTombstones(dev) |
| 151 | 152 |
| 152 self._env.parallel_devices.pMap( | 153 self._env.parallel_devices.pMap( |
| 153 individual_device_set_up, | 154 individual_device_set_up, |
| 154 self._test_instance.GetDataDependencies()) | 155 self._test_instance.GetDataDependencies()) |
| 155 | 156 |
| 157 #override |
| 156 def TearDown(self): | 158 def TearDown(self): |
| 157 @local_device_environment.handle_shard_failures_with( | 159 @local_device_environment.handle_shard_failures_with( |
| 158 self._env.BlacklistDevice) | 160 self._env.BlacklistDevice) |
| 159 def individual_device_tear_down(dev): | 161 def individual_device_tear_down(dev): |
| 160 if str(dev) in self._flag_changers: | 162 if str(dev) in self._flag_changers: |
| 161 self._flag_changers[str(dev)].Restore() | 163 self._flag_changers[str(dev)].Restore() |
| 162 | 164 |
| 163 # Remove package-specific configuration | 165 # Remove package-specific configuration |
| 164 dev.RunShellCommand(['am', 'clear-debug-app'], check_return=True) | 166 dev.RunShellCommand(['am', 'clear-debug-app'], check_return=True) |
| 165 | 167 |
| (...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 380 timeout = v | 382 timeout = v |
| 381 break | 383 break |
| 382 else: | 384 else: |
| 383 logging.warning('Using default 1 minute timeout for %s', test_name) | 385 logging.warning('Using default 1 minute timeout for %s', test_name) |
| 384 timeout = 60 | 386 timeout = 60 |
| 385 | 387 |
| 386 timeout *= cls._GetTimeoutScaleFromAnnotations(annotations) | 388 timeout *= cls._GetTimeoutScaleFromAnnotations(annotations) |
| 387 | 389 |
| 388 return timeout | 390 return timeout |
| 389 | 391 |
| OLD | NEW |