| OLD | NEW |
| 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2012 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 """ | 5 """ |
| 6 Classes in this file define additional actions that need to be taken to run a | 6 Classes in this file define additional actions that need to be taken to run a |
| 7 test under some kind of runtime error detection tool. | 7 test under some kind of runtime error detection tool. |
| 8 | 8 |
| 9 The interface is intended to be used as follows. | 9 The interface is intended to be used as follows. |
| 10 | 10 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 Call tool.CleanUpEnvironment(). | 21 Call tool.CleanUpEnvironment(). |
| 22 """ | 22 """ |
| 23 # pylint: disable=R0201 | 23 # pylint: disable=R0201 |
| 24 | 24 |
| 25 import glob | 25 import glob |
| 26 import logging | 26 import logging |
| 27 import os.path | 27 import os.path |
| 28 import subprocess | 28 import subprocess |
| 29 import sys | 29 import sys |
| 30 | 30 |
| 31 from devil.android import device_errors |
| 31 from pylib.constants import DIR_SOURCE_ROOT | 32 from pylib.constants import DIR_SOURCE_ROOT |
| 32 from pylib.device import device_errors | |
| 33 | 33 |
| 34 | 34 |
| 35 def SetChromeTimeoutScale(device, scale): | 35 def SetChromeTimeoutScale(device, scale): |
| 36 """Sets the timeout scale in /data/local/tmp/chrome_timeout_scale to scale.""" | 36 """Sets the timeout scale in /data/local/tmp/chrome_timeout_scale to scale.""" |
| 37 path = '/data/local/tmp/chrome_timeout_scale' | 37 path = '/data/local/tmp/chrome_timeout_scale' |
| 38 if not scale or scale == 1.0: | 38 if not scale or scale == 1.0: |
| 39 # Delete if scale is None/0.0/1.0 since the default timeout scale is 1.0 | 39 # Delete if scale is None/0.0/1.0 since the default timeout scale is 1.0 |
| 40 device.RunShellCommand('rm %s' % path) | 40 device.RunShellCommand('rm %s' % path) |
| 41 else: | 41 else: |
| 42 device.WriteFile(path, '%f' % scale, as_root=True) | 42 device.WriteFile(path, '%f' % scale, as_root=True) |
| (...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 291 return | 291 return |
| 292 | 292 |
| 293 clazz = TOOL_REGISTRY.get(tool_name) | 293 clazz = TOOL_REGISTRY.get(tool_name) |
| 294 if clazz: | 294 if clazz: |
| 295 clazz.CopyFiles(device) | 295 clazz.CopyFiles(device) |
| 296 else: | 296 else: |
| 297 print 'Unknown tool %s, available tools: %s' % ( | 297 print 'Unknown tool %s, available tools: %s' % ( |
| 298 tool_name, ', '.join(sorted(TOOL_REGISTRY.keys()))) | 298 tool_name, ', '.join(sorted(TOOL_REGISTRY.keys()))) |
| 299 sys.exit(1) | 299 sys.exit(1) |
| 300 | 300 |
| OLD | NEW |