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 17 matching lines...) Expand all Loading... |
28 from constants import CHROME_DIR | 28 from constants import CHROME_DIR |
29 | 29 |
30 | 30 |
31 def SetChromeTimeoutScale(adb, scale): | 31 def SetChromeTimeoutScale(adb, scale): |
32 """Sets the timeout scale in /data/local/tmp/chrome_timeout_scale to scale.""" | 32 """Sets the timeout scale in /data/local/tmp/chrome_timeout_scale to scale.""" |
33 path = '/data/local/tmp/chrome_timeout_scale' | 33 path = '/data/local/tmp/chrome_timeout_scale' |
34 if not scale or scale == 1.0: | 34 if not scale or scale == 1.0: |
35 # Delete if scale is None/0.0/1.0 since the default timeout scale is 1.0 | 35 # Delete if scale is None/0.0/1.0 since the default timeout scale is 1.0 |
36 adb.RunShellCommand('rm %s' % path) | 36 adb.RunShellCommand('rm %s' % path) |
37 else: | 37 else: |
38 adb.SetFileContents(path, '%f' % scale) | 38 adb.SetProtectedFileContents(path, '%f' % scale) |
39 | 39 |
40 | 40 |
41 class BaseTool(object): | 41 class BaseTool(object): |
42 """A tool that does nothing.""" | 42 """A tool that does nothing.""" |
43 | 43 |
44 def GetTestWrapper(self): | 44 def GetTestWrapper(self): |
45 """Returns a string that is to be prepended to the test command line.""" | 45 """Returns a string that is to be prepended to the test command line.""" |
46 return '' | 46 return '' |
47 | 47 |
48 def GetUtilWrapper(self): | 48 def GetUtilWrapper(self): |
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
248 if not tool_name: | 248 if not tool_name: |
249 return BaseTool() | 249 return BaseTool() |
250 | 250 |
251 ctor = TOOL_REGISTRY.get(tool_name) | 251 ctor = TOOL_REGISTRY.get(tool_name) |
252 if ctor: | 252 if ctor: |
253 return ctor(adb) | 253 return ctor(adb) |
254 else: | 254 else: |
255 print 'Unknown tool %s, available tools: %s' % ( | 255 print 'Unknown tool %s, available tools: %s' % ( |
256 tool_name, ', '.join(sorted(TOOL_REGISTRY.keys()))) | 256 tool_name, ', '.join(sorted(TOOL_REGISTRY.keys()))) |
257 sys.exit(1) | 257 sys.exit(1) |
OLD | NEW |