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

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

Issue 62953024: [Telemetry] Refactor common Android cleanup functions. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rename + move wait-for-device + rebase Created 7 years 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/perf/setup.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 484 matching lines...) Expand 10 before | Expand all | Expand 10 after
495 return ret 495 return ret
496 496
497 def StartAdbServer(self): 497 def StartAdbServer(self):
498 """Start adb server.""" 498 """Start adb server."""
499 adb_cmd = ['taskset', '-c', '0', constants.ADB_PATH, 'start-server'] 499 adb_cmd = ['taskset', '-c', '0', constants.ADB_PATH, 'start-server']
500 ret = cmd_helper.RunCmd(adb_cmd) 500 ret = cmd_helper.RunCmd(adb_cmd)
501 retry = 0 501 retry = 0
502 while retry < 3: 502 while retry < 3:
503 ret = cmd_helper.RunCmd(['pgrep', 'adb']) 503 ret = cmd_helper.RunCmd(['pgrep', 'adb'])
504 if ret == 0: 504 if ret == 0:
505 # pgrep fonud adb, start-server succeeded. 505 # pgrep found adb, start-server succeeded.
506 # Waiting for device to reconnect before returning success.
507 self._adb.SendCommand('wait-for-device')
506 return 0 508 return 0
507 retry += 1 509 retry += 1
508 time.sleep(retry) 510 time.sleep(retry)
509 return ret 511 return ret
510 512
511 def WaitForSystemBootCompleted(self, wait_time): 513 def WaitForSystemBootCompleted(self, wait_time):
512 """Waits for targeted system's boot_completed flag to be set. 514 """Waits for targeted system's boot_completed flag to be set.
513 515
514 Args: 516 Args:
515 wait_time: time in seconds to wait 517 wait_time: time in seconds to wait
(...skipping 1187 matching lines...) Expand 10 before | Expand all | Expand 10 after
1703 """ 1705 """
1704 def __init__(self, output): 1706 def __init__(self, output):
1705 self._output = output 1707 self._output = output
1706 1708
1707 def write(self, data): 1709 def write(self, data):
1708 data = data.replace('\r\r\n', '\n') 1710 data = data.replace('\r\r\n', '\n')
1709 self._output.write(data) 1711 self._output.write(data)
1710 1712
1711 def flush(self): 1713 def flush(self):
1712 self._output.flush() 1714 self._output.flush()
OLDNEW
« no previous file with comments | « no previous file | build/android/pylib/perf/setup.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698