| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright (c) 2011 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
| 5 | 5 |
| 6 """Provides an interface to communicate with the device via the adb command. | 6 """Provides an interface to communicate with the device via the adb command. |
| 7 | 7 |
| 8 Assumes adb binary is currently on system path. | 8 Assumes adb binary is currently on system path. |
| 9 | 9 |
| 10 Usage: | 10 Usage: |
| 11 python android_commands.py wait-for-pm | 11 python android_commands.py wait-for-pm |
| 12 """ | 12 """ |
| 13 | 13 |
| 14 import collections | 14 import collections |
| 15 import datetime | 15 import datetime |
| 16 import logging | 16 import logging |
| 17 import optparse | 17 import optparse |
| 18 import os | 18 import os |
| 19 import pexpect | 19 import pexpect |
| 20 import re | 20 import re |
| 21 import subprocess | 21 import subprocess |
| 22 import sys | 22 import sys |
| 23 import tempfile | 23 import tempfile |
| 24 import time | 24 import time |
| 25 | 25 |
| 26 # adb_interface.py is under ../../third_party/android/testrunner/ | 26 # adb_interface.py is under ../../third_party/android_testrunner/ |
| 27 sys.path.append(os.path.join(os.path.abspath(os.path.dirname(__file__)), '..', | 27 sys.path.append(os.path.join(os.path.abspath(os.path.dirname(__file__)), '..', |
| 28 '..', 'third_party', 'android', 'testrunner')) | 28 '..', 'third_party', 'android_testrunner')) |
| 29 import adb_interface | 29 import adb_interface |
| 30 import cmd_helper | 30 import cmd_helper |
| 31 import errors # is under ../../third_party/android/testrunner/errors.py | 31 import errors # is under ../../third_party/android_testrunner/errors.py |
| 32 from run_tests_helper import IsRunningAsBuildbot | 32 from run_tests_helper import IsRunningAsBuildbot |
| 33 | 33 |
| 34 | 34 |
| 35 # Pattern to search for the next whole line of pexpect output and capture it | 35 # Pattern to search for the next whole line of pexpect output and capture it |
| 36 # into a match group. We can't use ^ and $ for line start end with pexpect, | 36 # into a match group. We can't use ^ and $ for line start end with pexpect, |
| 37 # see http://www.noah.org/python/pexpect/#doc for explanation why. | 37 # see http://www.noah.org/python/pexpect/#doc for explanation why. |
| 38 PEXPECT_LINE_RE = re.compile('\n([^\r]*)\r') | 38 PEXPECT_LINE_RE = re.compile('\n([^\r]*)\r') |
| 39 | 39 |
| 40 # Set the adb shell prompt to be a unique marker that will [hopefully] not | 40 # Set the adb shell prompt to be a unique marker that will [hopefully] not |
| 41 # appear at the start of any line of a command's output. | 41 # appear at the start of any line of a command's output. |
| (...skipping 729 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 771 options, args = option_parser.parse_args(argv) | 771 options, args = option_parser.parse_args(argv) |
| 772 | 772 |
| 773 commands = AndroidCommands(wait_for_pm=options.wait_for_pm) | 773 commands = AndroidCommands(wait_for_pm=options.wait_for_pm) |
| 774 if options.set_asserts != None: | 774 if options.set_asserts != None: |
| 775 if commands.SetJavaAssertsEnabled(options.set_asserts): | 775 if commands.SetJavaAssertsEnabled(options.set_asserts): |
| 776 commands.Reboot(full_reboot=False) | 776 commands.Reboot(full_reboot=False) |
| 777 | 777 |
| 778 | 778 |
| 779 if __name__ == '__main__': | 779 if __name__ == '__main__': |
| 780 main(sys.argv) | 780 main(sys.argv) |
| OLD | NEW |