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

Unified Diff: tools/cygprofile/profile_android_startup.py

Issue 1290173003: [Android] Reland of Remove android_commands and android_testrunner. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fixed: removed references from content/telemetry.isolate and TELEMETRY_DEPS Created 5 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tools/checkperms/checkperms.py ('k') | tools/telemetry/telemetry/TELEMETRY_DEPS » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/cygprofile/profile_android_startup.py
diff --git a/tools/cygprofile/profile_android_startup.py b/tools/cygprofile/profile_android_startup.py
index 9e49bef0a899887f7e5ab1413366999d472c8e0a..29fad7484afd274c4af3baf15d397df12a1daa5d 100644
--- a/tools/cygprofile/profile_android_startup.py
+++ b/tools/cygprofile/profile_android_startup.py
@@ -218,12 +218,15 @@ class AndroidProfileTool(object):
The exit code for the tests.
"""
device_path = '/data/local/tmp/cygprofile_unittests'
- self._device.old_interface.PushIfNeeded(
- self._cygprofile_tests, device_path)
- (exit_code, _) = (
- self._device.old_interface.GetShellCommandStatusAndOutput(
- command=device_path, log_result=True))
- return exit_code
+ self._device.PushChangedFiles([(self._cygprofile_tests, device_path)])
+ try:
+ self._device.RunShellCommand(device_path, check_return=True)
+ except device_errors.CommandFailedError:
+ # TODO(jbudorick): Let the exception propagate up once clients can
+ # handle it.
+ logging.exception('Failure while running cygprofile_unittests:')
+ return 1
+ return 0
def CollectProfile(self, apk, package_info):
"""Run a profile and collect the log files.
@@ -237,8 +240,7 @@ class AndroidProfileTool(object):
Raises:
NoCyglogDataError: No data was found on the device.
"""
- self._Install(apk, package_info)
-
+ self._Install(apk)
try:
changer = self._SetChromeFlags(package_info)
self._SetUpDeviceFolders()
@@ -266,7 +268,7 @@ class AndroidProfileTool(object):
self._DeleteDeviceData()
self._DeleteHostData()
- def _Install(self, apk, package_info):
+ def _Install(self, apk):
"""Installs Chrome.apk on the device.
Args:
apk: The location of the chrome apk to profile.
@@ -274,7 +276,7 @@ class AndroidProfileTool(object):
as from pylib/constants.
"""
print 'Installing apk...'
- self._device.old_interface.ManagedInstall(apk, package_info.package)
+ self._device.Install(apk)
def _SetUpDevice(self):
"""When profiling, files are output to the disk by every process. This
@@ -287,7 +289,7 @@ class AndroidProfileTool(object):
# SELinux need to be in permissive mode, otherwise the process cannot
# write the log files.
print 'Putting SELinux in permissive mode...'
- self._device.old_interface.RunShellCommand('setenforce 0')
+ self._device.RunShellCommand(['setenforce' '0'], check_return=True)
except device_errors.CommandFailedError as e:
# TODO(jbudorick) Handle this exception appropriately once interface
# conversions are finished.
@@ -309,13 +311,15 @@ class AndroidProfileTool(object):
"""Creates folders on the device to store cyglog data. """
print 'Setting up device folders...'
self._DeleteDeviceData()
- self._device.old_interface.RunShellCommand(
- 'mkdir -p %s' % self._DEVICE_CYGLOG_DIR)
+ self._device.RunShellCommand(
+ ['mkdir', '-p', str(self._DEVICE_CYGLOG_DIR)],
+ check_return=True)
def _DeleteDeviceData(self):
"""Clears out cyglog storage locations on the device. """
- self._device.old_interface.RunShellCommand(
- 'rm -rf %s' % self._DEVICE_CYGLOG_DIR)
+ self._device.RunShellCommand(
+ ['rm', '-rf', str(self._DEVICE_CYGLOG_DIR)],
+ check_return=True)
def _StartChrome(self, package_info, url):
print 'Launching chrome...'
@@ -347,7 +351,7 @@ class AndroidProfileTool(object):
"""
print 'Pulling cyglog data...'
self._SetUpHostFolders()
- self._device.old_interface.Adb().Pull(
+ self._device.PullFile(
self._DEVICE_CYGLOG_DIR, self._host_cyglog_dir)
files = os.listdir(self._host_cyglog_dir)
« no previous file with comments | « tools/checkperms/checkperms.py ('k') | tools/telemetry/telemetry/TELEMETRY_DEPS » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698