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

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

Issue 10693110: [android] Split top-level scripts and libraries from build/android. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Copyright on __init__.py, removed #! on some pylib/ files. Created 8 years, 5 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
« no previous file with comments | « build/android/pylib/__init__.py ('k') | build/android/pylib/base_test_runner.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
3 # 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
4 # found in the LICENSE file. 3 # found in the LICENSE file.
5 4
6 """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.
7 6
8 Assumes adb binary is currently on system path. 7 Assumes adb binary is currently on system path.
9 8
10 Usage: 9 Usage:
11 python android_commands.py wait-for-pm 10 python android_commands.py wait-for-pm
12 """ 11 """
13 12
14 import collections 13 import collections
15 import datetime 14 import datetime
16 import logging 15 import logging
17 import optparse 16 import optparse
18 import os 17 import os
19 import pexpect 18 import pexpect
20 import re 19 import re
21 import subprocess 20 import subprocess
22 import sys 21 import sys
23 import tempfile 22 import tempfile
24 import time 23 import time
25 24
26 # adb_interface.py is under ../../third_party/android_testrunner/ 25 # adb_interface.py is under ../../../third_party/android_testrunner/
27 sys.path.append(os.path.join(os.path.abspath(os.path.dirname(__file__)), '..', 26 sys.path.append(os.path.join(os.path.abspath(os.path.dirname(__file__)), '..',
28 '..', 'third_party', 'android_testrunner')) 27 '..', '..', 'third_party', 'android_testrunner'))
29 import adb_interface 28 import adb_interface
30 import cmd_helper 29 import cmd_helper
31 import errors # is under ../../third_party/android_testrunner/errors.py 30 import errors # is under ../../third_party/android_testrunner/errors.py
32 from run_tests_helper import IsRunningAsBuildbot 31 from run_tests_helper import IsRunningAsBuildbot
33 32
34 33
35 # Pattern to search for the next whole line of pexpect output and capture it 34 # 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, 35 # 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. 36 # see http://www.noah.org/python/pexpect/#doc for explanation why.
38 PEXPECT_LINE_RE = re.compile('\n([^\r]*)\r') 37 PEXPECT_LINE_RE = re.compile('\n([^\r]*)\r')
(...skipping 709 matching lines...) Expand 10 before | Expand all | Expand 10 after
748 def UnlockDevice(self): 747 def UnlockDevice(self):
749 """Unlocks the screen of the device.""" 748 """Unlocks the screen of the device."""
750 # Make sure a menu button event will actually unlock the screen. 749 # Make sure a menu button event will actually unlock the screen.
751 if IsRunningAsBuildbot(): 750 if IsRunningAsBuildbot():
752 assert self.RunShellCommand('getprop ro.test_harness')[0].strip() == '1' 751 assert self.RunShellCommand('getprop ro.test_harness')[0].strip() == '1'
753 # The following keyevent unlocks the screen if locked. 752 # The following keyevent unlocks the screen if locked.
754 self.SendKeyEvent(KEYCODE_MENU) 753 self.SendKeyEvent(KEYCODE_MENU)
755 # If the screen wasn't locked the previous command will bring up the menu, 754 # If the screen wasn't locked the previous command will bring up the menu,
756 # which this will dismiss. Otherwise this shouldn't change anything. 755 # which this will dismiss. Otherwise this shouldn't change anything.
757 self.SendKeyEvent(KEYCODE_BACK) 756 self.SendKeyEvent(KEYCODE_BACK)
758
759
760 def main(argv):
761 option_parser = optparse.OptionParser()
762 option_parser.add_option('-w', '--wait_for_pm', action='store_true',
763 default=False, dest='wait_for_pm',
764 help='Waits for Device Package Manager to become available')
765 option_parser.add_option('--enable_asserts', dest='set_asserts',
766 action='store_true', default=None,
767 help='Sets the dalvik.vm.enableassertions property to "all"')
768 option_parser.add_option('--disable_asserts', dest='set_asserts',
769 action='store_false', default=None,
770 help='Removes the dalvik.vm.enableassertions property')
771 options, args = option_parser.parse_args(argv)
772
773 commands = AndroidCommands(wait_for_pm=options.wait_for_pm)
774 if options.set_asserts != None:
775 if commands.SetJavaAssertsEnabled(options.set_asserts):
776 commands.Reboot(full_reboot=False)
777
778
779 if __name__ == '__main__':
780 main(sys.argv)
OLDNEW
« no previous file with comments | « build/android/pylib/__init__.py ('k') | build/android/pylib/base_test_runner.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698