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

Unified Diff: tools/telemetry/telemetry/core/chrome/adb_commands.py

Issue 22903016: [android] Adds constants.GetOutDirectory() and converts test scripts to use it. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: update adb_install_apk.py Created 7 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
Index: tools/telemetry/telemetry/core/chrome/adb_commands.py
diff --git a/tools/telemetry/telemetry/core/chrome/adb_commands.py b/tools/telemetry/telemetry/core/chrome/adb_commands.py
index fa71813637a4ef3ceb77a84db4c9bc944bd6735e..d64109d6d78ad5d3e5aa9353737a592855cec15a 100644
--- a/tools/telemetry/telemetry/core/chrome/adb_commands.py
+++ b/tools/telemetry/telemetry/core/chrome/adb_commands.py
@@ -14,7 +14,7 @@ from telemetry.core import util
util.AddDirToPythonPath(util.GetChromiumSrcDir(), 'build', 'android')
try:
from pylib import android_commands # pylint: disable=F0401
- from pylib import cmd_helper # pylint: disable=F0401
+ from pylib import constants # pylint: disable=F0401
from pylib import forwarder # pylint: disable=F0401
from pylib import ports # pylint: disable=F0401
except Exception:
@@ -41,10 +41,6 @@ def ResetTestServerPortAllocation():
return ports.ResetTestServerPortAllocation()
-def GetOutDirectory():
- return cmd_helper.OutDirectory.get()
-
-
class AdbCommands(object):
"""A thin wrapper around ADB"""
@@ -149,10 +145,11 @@ def HasForwarder(buildtype=None):
if not buildtype:
return (HasForwarder(buildtype='Release') or
HasForwarder(buildtype='Debug'))
- return (os.path.exists(os.path.join(GetOutDirectory(), buildtype,
- 'device_forwarder')) and
- os.path.exists(os.path.join(GetOutDirectory(), buildtype,
- 'host_forwarder')))
+ device_forwarder = os.path.join(
+ constants.GetBuildDirectory(build_type=buildtype), 'device_forwarder')
+ host_forwarder = os.path.join(
+ constants.GetBuildDirectory(build_type=buildtype), 'host_forwarder')
+ return os.path.exists(device_forwarder) and os.path.exists(host_forwarder)
class Forwarder(object):
def __init__(self, adb, *port_pairs):
@@ -163,13 +160,14 @@ class Forwarder(object):
for port_pair in port_pairs]
self._port_pairs = new_port_pairs
+ if HasForwarder('Release'):
+ constants.SetBuildType('Release')
+ elif HasForwarder('Debug'):
+ constants.SetBuildType('Debug')
+ else:
+ raise Exception('Build forwarder2')
forwarder.Forwarder.Map(new_port_pairs, self._adb)
- @staticmethod
- def _GetBuildType():
- assert HasForwarder()
- return 'Debug' if HasForwarder('Debug') else 'Release'
-
@property
def url(self):
return 'http://localhost:%i' % self._host_port

Powered by Google App Engine
This is Rietveld 408576698