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

Unified Diff: build/android/pylib/flag_changer.py

Issue 221823011: [Android] Change object types from AndroidCommands to DeviceUtils in build/android/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 8 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 | « build/android/pylib/device_settings.py ('k') | build/android/pylib/forwarder.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/android/pylib/flag_changer.py
diff --git a/build/android/pylib/flag_changer.py b/build/android/pylib/flag_changer.py
index d20da36b4e688f3391b182f09b6b46c782dd7719..c1e8cb8f34602940f377df008b039e3886c5dc4f 100644
--- a/build/android/pylib/flag_changer.py
+++ b/build/android/pylib/flag_changer.py
@@ -4,6 +4,9 @@
import logging
+import pylib.android_commands
+import pylib.device.device_utils
+
class FlagChanger(object):
"""Changes the flags Chrome runs with.
@@ -15,18 +18,22 @@ class FlagChanger(object):
once the tests have completed.
"""
- def __init__(self, adb, cmdline_file):
+ def __init__(self, device, cmdline_file):
"""Initializes the FlagChanger and records the original arguments.
Args:
- adb: An instance of AndroidCommands.
+ device: A DeviceUtils instance.
cmdline_file: Path to the command line file on the device.
"""
- self._adb = adb
+ # TODO(jbudorick) Remove once telemetry switches over.
+ if isinstance(device, pylib.android_commands.AndroidCommands):
+ device = pylib.device.device_utils.DeviceUtils(device)
+ self._device = device
self._cmdline_file = cmdline_file
# Save the original flags.
- self._orig_line = self._adb.GetFileContents(self._cmdline_file)
+ self._orig_line = self._device.old_interface.GetFileContents(
+ self._cmdline_file)
if self._orig_line:
self._orig_line = self._orig_line[0].strip()
@@ -96,19 +103,25 @@ class FlagChanger(object):
# launching the chrome executable using this command line.
cmd_line = ' '.join(['_'] + self._current_flags)
if use_root:
- self._adb.SetProtectedFileContents(self._cmdline_file, cmd_line)
- file_contents = self._adb.GetProtectedFileContents(self._cmdline_file)
+ self._device.old_interface.SetProtectedFileContents(
+ self._cmdline_file, cmd_line)
+ file_contents = self._device.old_interface.GetProtectedFileContents(
+ self._cmdline_file)
else:
- self._adb.SetFileContents(self._cmdline_file, cmd_line)
- file_contents = self._adb.GetFileContents(self._cmdline_file)
+ self._device.old_interface.SetFileContents(self._cmdline_file, cmd_line)
+ file_contents = self._device.old_interface.GetFileContents(
+ self._cmdline_file)
assert len(file_contents) == 1 and file_contents[0] == cmd_line, (
'Failed to set the command line file at %s' % self._cmdline_file)
else:
if use_root:
- self._adb.RunShellCommandWithSU('rm ' + self._cmdline_file)
+ self._device.old_interface.RunShellCommandWithSU(
+ 'rm ' + self._cmdline_file)
else:
- self._adb.RunShellCommand('rm ' + self._cmdline_file)
- assert not self._adb.FileExistsOnDevice(self._cmdline_file), (
+ self._device.old_interface.RunShellCommand('rm ' + self._cmdline_file)
+ assert (
+ not self._device.old_interface.FileExistsOnDevice(
+ self._cmdline_file)), (
'Failed to remove the command line file at %s' % self._cmdline_file)
@staticmethod
« no previous file with comments | « build/android/pylib/device_settings.py ('k') | build/android/pylib/forwarder.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698