Chromium Code Reviews| 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 """Provides an interface to communicate with the device via the adb command. | 5 """Provides an interface to communicate with the device via the adb command. |
| 6 | 6 |
| 7 Assumes adb binary is currently on system path. | 7 Assumes adb binary is currently on system path. |
| 8 """ | 8 """ |
| 9 | 9 |
| 10 import collections | 10 import collections |
| (...skipping 577 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 588 | 588 |
| 589 Args: | 589 Args: |
| 590 package: Name of the process to kill off, e.g. | 590 package: Name of the process to kill off, e.g. |
| 591 com.google.android.apps.chrome | 591 com.google.android.apps.chrome |
| 592 """ | 592 """ |
| 593 self.RunShellCommand('am force-stop ' + package) | 593 self.RunShellCommand('am force-stop ' + package) |
| 594 | 594 |
| 595 def ClearApplicationState(self, package): | 595 def ClearApplicationState(self, package): |
| 596 """Closes and clears all state for the given |package|.""" | 596 """Closes and clears all state for the given |package|.""" |
| 597 self.CloseApplication(package) | 597 self.CloseApplication(package) |
| 598 self.RunShellCommand('rm -r /data/data/%s/app_*' % package) | 598 self.RunShellCommand('su -c rm -r /data/data/%s/app_*' % package) |
| 599 self.RunShellCommand('rm -r /data/data/%s/cache/*' % package) | 599 self.RunShellCommand('su -c rm -r /data/data/%s/cache/*' % package) |
| 600 self.RunShellCommand('rm -r /data/data/%s/files/*' % package) | 600 self.RunShellCommand('su -c rm -r /data/data/%s/files/*' % package) |
| 601 self.RunShellCommand('rm -r /data/data/%s/shared_prefs/*' % package) | 601 self.RunShellCommand('su -c rm -r /data/data/%s/shared_prefs/*' % package) |
|
frankf
2013/01/30 18:15:20
can you create a wrapper around these, something l
| |
| 602 | 602 |
| 603 def SendKeyEvent(self, keycode): | 603 def SendKeyEvent(self, keycode): |
| 604 """Sends keycode to the device. | 604 """Sends keycode to the device. |
| 605 | 605 |
| 606 Args: | 606 Args: |
| 607 keycode: Numeric keycode to send (see "enum" at top of file). | 607 keycode: Numeric keycode to send (see "enum" at top of file). |
| 608 """ | 608 """ |
| 609 self.RunShellCommand('input keyevent %d' % keycode) | 609 self.RunShellCommand('input keyevent %d' % keycode) |
| 610 | 610 |
| 611 def PushIfNeeded(self, local_path, device_path): | 611 def PushIfNeeded(self, local_path, device_path): |
| (...skipping 536 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1148 """ | 1148 """ |
| 1149 def __init__(self, output): | 1149 def __init__(self, output): |
| 1150 self._output = output | 1150 self._output = output |
| 1151 | 1151 |
| 1152 def write(self, data): | 1152 def write(self, data): |
| 1153 data = data.replace('\r\r\n', '\n') | 1153 data = data.replace('\r\r\n', '\n') |
| 1154 self._output.write(data) | 1154 self._output.write(data) |
| 1155 | 1155 |
| 1156 def flush(self): | 1156 def flush(self): |
| 1157 self._output.flush() | 1157 self._output.flush() |
| OLD | NEW |