Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(808)

Side by Side Diff: build/android/pylib/android_commands.py

Issue 12250010: [Android] Better handle gtest crashes that generate pexpect.EOF. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | build/android/pylib/gtest/test_package.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 self._pushed_files = [] 208 self._pushed_files = []
209 self._device_utc_offset = self.RunShellCommand('date +%z')[0] 209 self._device_utc_offset = self.RunShellCommand('date +%z')[0]
210 self._md5sum_path = '' 210 self._md5sum_path = ''
211 self._external_storage = '' 211 self._external_storage = ''
212 self._util_wrapper = '' 212 self._util_wrapper = ''
213 213
214 def Adb(self): 214 def Adb(self):
215 """Returns our AdbInterface to avoid us wrapping all its methods.""" 215 """Returns our AdbInterface to avoid us wrapping all its methods."""
216 return self._adb 216 return self._adb
217 217
218 def IsOnline(self):
219 """Checks whether the device is online.
220
221 Returns:
222 True if device is in 'device' mode, False otherwise.
223 """
224 out = self._adb.SendCommand('get-state')
225 return out.strip() == 'device'
226
218 def IsRootEnabled(self): 227 def IsRootEnabled(self):
219 """Checks if root is enabled on the device.""" 228 """Checks if root is enabled on the device."""
220 root_test_output = self.RunShellCommand('ls /root') or [''] 229 root_test_output = self.RunShellCommand('ls /root') or ['']
221 return not 'Permission denied' in root_test_output[0] 230 return not 'Permission denied' in root_test_output[0]
222 231
223 def EnableAdbRoot(self): 232 def EnableAdbRoot(self):
224 """Enables adb root on the device. 233 """Enables adb root on the device.
225 234
226 Returns: 235 Returns:
227 True: if output from executing adb root was as expected. 236 True: if output from executing adb root was as expected.
(...skipping 979 matching lines...) Expand 10 before | Expand all | Expand 10 after
1207 """ 1216 """
1208 def __init__(self, output): 1217 def __init__(self, output):
1209 self._output = output 1218 self._output = output
1210 1219
1211 def write(self, data): 1220 def write(self, data):
1212 data = data.replace('\r\r\n', '\n') 1221 data = data.replace('\r\r\n', '\n')
1213 self._output.write(data) 1222 self._output.write(data)
1214 1223
1215 def flush(self): 1224 def flush(self):
1216 self._output.flush() 1225 self._output.flush()
OLDNEW
« no previous file with comments | « no previous file | build/android/pylib/gtest/test_package.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698