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

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

Issue 13989007: [Android] Split uiautomator test runner from instrumentation. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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 unified diff | Download patch | Annotate | Revision Log
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 1254 matching lines...) Expand 10 before | Expand all | Expand 10 after
1265 Returns: 1265 Returns:
1266 An instance of am_instrument_parser.TestResult object. 1266 An instance of am_instrument_parser.TestResult object.
1267 """ 1267 """
1268 cmd = 'uiautomator runtest %s -e class %s' % (test_package, test) 1268 cmd = 'uiautomator runtest %s -e class %s' % (test_package, test)
1269 self._LogShell(cmd) 1269 self._LogShell(cmd)
1270 output = self._adb.SendShellCommand(cmd, timeout_time=timeout) 1270 output = self._adb.SendShellCommand(cmd, timeout_time=timeout)
1271 # uiautomator doesn't fully conform to the instrumenation test runner 1271 # uiautomator doesn't fully conform to the instrumenation test runner
1272 # convention and doesn't terminate with INSTRUMENTATION_CODE. 1272 # convention and doesn't terminate with INSTRUMENTATION_CODE.
1273 # Just assume the first result is valid. 1273 # Just assume the first result is valid.
1274 (test_results, _) = am_instrument_parser.ParseAmInstrumentOutput(output) 1274 (test_results, _) = am_instrument_parser.ParseAmInstrumentOutput(output)
1275 if not test_results:
1276 raise errors.InstrumentationError(
1277 'no test results... device setup correctly?')
1275 return test_results[0] 1278 return test_results[0]
1276 1279
1277 1280
1278 class NewLineNormalizer(object): 1281 class NewLineNormalizer(object):
1279 """A file-like object to normalize EOLs to '\n'. 1282 """A file-like object to normalize EOLs to '\n'.
1280 1283
1281 Pexpect runs adb within a pseudo-tty device (see 1284 Pexpect runs adb within a pseudo-tty device (see
1282 http://www.noah.org/wiki/pexpect), so any '\n' printed by adb is written 1285 http://www.noah.org/wiki/pexpect), so any '\n' printed by adb is written
1283 as '\r\n' to the logfile. Since adb already uses '\r\n' to terminate 1286 as '\r\n' to the logfile. Since adb already uses '\r\n' to terminate
1284 lines, the log ends up having '\r\r\n' at the end of each line. This 1287 lines, the log ends up having '\r\r\n' at the end of each line. This
1285 filter replaces the above with a single '\n' in the data stream. 1288 filter replaces the above with a single '\n' in the data stream.
1286 """ 1289 """
1287 def __init__(self, output): 1290 def __init__(self, output):
1288 self._output = output 1291 self._output = output
1289 1292
1290 def write(self, data): 1293 def write(self, data):
1291 data = data.replace('\r\r\n', '\n') 1294 data = data.replace('\r\r\n', '\n')
1292 self._output.write(data) 1295 self._output.write(data)
1293 1296
1294 def flush(self): 1297 def flush(self):
1295 self._output.flush() 1298 self._output.flush()
OLDNEW
« no previous file with comments | « no previous file | build/android/pylib/base/base_test_runner.py » ('j') | build/android/pylib/uiautomator/test_runner.py » ('J')

Powered by Google App Engine
This is Rietveld 408576698