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

Side by Side Diff: mojo/devtools/common/devtoolslib/android_shell.py

Issue 1376603007: Teach mojo_benchmark --save-traces to pull results from Android devices. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 2 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
« no previous file with comments | « no previous file | mojo/devtools/common/mojo_benchmark » ('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 2014 The Chromium Authors. All rights reserved. 1 # Copyright 2014 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 import atexit 5 import atexit
6 import hashlib 6 import hashlib
7 import json 7 import json
8 import logging 8 import logging
9 import os 9 import os
10 import os.path 10 import os.path
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 self.adb_running_as_root = False 192 self.adb_running_as_root = False
193 193
194 return self.adb_running_as_root 194 return self.adb_running_as_root
195 195
196 def _is_shell_package_installed(self): 196 def _is_shell_package_installed(self):
197 # Adb should print one line if the package is installed and return empty 197 # Adb should print one line if the package is installed and return empty
198 # string otherwise. 198 # string otherwise.
199 return len(subprocess.check_output(self._adb_command([ 199 return len(subprocess.check_output(self._adb_command([
200 'shell', 'pm', 'list', 'packages', _MOJO_SHELL_PACKAGE_NAME]))) > 0 200 'shell', 'pm', 'list', 'packages', _MOJO_SHELL_PACKAGE_NAME]))) > 0
201 201
202 @staticmethod
203 def get_tmp_dir_path():
etiennej 2015/10/02 10:58:05 Docstring please
ppi 2015/10/03 21:48:49 Done.
204 return '/data/data/%s/cache/tmp/' % _MOJO_SHELL_PACKAGE_NAME
205
206 def pull_file(self, device_path, destination_path, remove_original=False):
etiennej 2015/10/02 10:58:04 Docstring
ppi 2015/10/03 21:48:49 Done.
207 subprocess.check_call(self._adb_command([
208 'pull', device_path, destination_path]))
209 if remove_original:
210 subprocess.check_call(self._adb_command([
211 'shell', 'rm', device_path]))
212
202 def check_device(self, require_root=False): 213 def check_device(self, require_root=False):
203 """Verifies if the device configuration allows adb to run. 214 """Verifies if the device configuration allows adb to run.
204 215
205 If a target device was indicated in the constructor, it checks that the 216 If a target device was indicated in the constructor, it checks that the
206 device is available. Otherwise, it checks that there is exactly one 217 device is available. Otherwise, it checks that there is exactly one
207 available device. 218 available device.
208 219
209 Returns: 220 Returns:
210 A tuple of (result, msg). |result| is True iff if the device is correctly 221 A tuple of (result, msg). |result| is True iff if the device is correctly
211 configured and False otherwise. |msg| is the reason for failure if 222 configured and False otherwise. |msg| is the reason for failure if
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
421 Results.output = rf.read() 432 Results.output = rf.read()
422 433
423 run_thread = threading.Thread(target=do_run) 434 run_thread = threading.Thread(target=do_run)
424 run_thread.start() 435 run_thread.start()
425 run_thread.join(timeout) 436 run_thread.join(timeout)
426 437
427 if run_thread.is_alive(): 438 if run_thread.is_alive():
428 self.stop_shell() 439 self.stop_shell()
429 return None, Results.output, True 440 return None, Results.output, True
430 return None, Results.output, False 441 return None, Results.output, False
OLDNEW
« no previous file with comments | « no previous file | mojo/devtools/common/mojo_benchmark » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698