| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # | 2 # |
| 3 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 3 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 4 # Use of this source code is governed by a BSD-style license that can be | 4 # Use of this source code is governed by a BSD-style license that can be |
| 5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
| 6 | 6 |
| 7 from multiprocessing import Process | 7 from multiprocessing import Process |
| 8 import optparse | 8 import optparse |
| 9 import os | 9 import os |
| 10 import sys | 10 import sys |
| 11 | 11 |
| 12 from pylib import android_commands | 12 from pylib import android_commands |
| 13 from pylib import test_options_parser | 13 from pylib import test_options_parser |
| 14 from pylib import constants |
| 14 | 15 |
| 15 | 16 |
| 16 def InstallContentShell(device, build_type): | 17 def InstallContentShell(device, build_type): |
| 17 apk_path = os.path.join(os.environ['CHROME_SRC'], | 18 apk_path = os.path.join(os.environ['CHROME_SRC'], |
| 18 'out', build_type, | 19 'out', build_type, |
| 19 'content_shell', 'ContentShell-debug.apk') | 20 constants.SDK_BUILD_APKS_DIR, 'ContentShell-debug.apk'
) |
| 20 result = android_commands.AndroidCommands(device=device).ManagedInstall( | 21 result = android_commands.AndroidCommands(device=device).ManagedInstall( |
| 21 apk_path, False, 'org.chromium.content_shell') | 22 apk_path, False, 'org.chromium.content_shell') |
| 22 print '----- Installed on %s -----' % device | 23 print '----- Installed on %s -----' % device |
| 23 print result | 24 print result |
| 24 | 25 |
| 25 | 26 |
| 26 parser = optparse.OptionParser() | 27 parser = optparse.OptionParser() |
| 27 test_options_parser.AddBuildTypeOption(parser) | 28 test_options_parser.AddBuildTypeOption(parser) |
| 28 options, args = parser.parse_args(sys.argv) | 29 options, args = parser.parse_args(sys.argv) |
| 29 | 30 |
| 30 devices = android_commands.GetAttachedDevices() | 31 devices = android_commands.GetAttachedDevices() |
| 31 if not devices: | 32 if not devices: |
| 32 raise Exception('Error: no connected devices') | 33 raise Exception('Error: no connected devices') |
| 33 | 34 |
| 34 procs = [] | 35 procs = [] |
| 35 for device in devices: | 36 for device in devices: |
| 36 p = Process(target=InstallContentShell, args=(device, options.build_type)) | 37 p = Process(target=InstallContentShell, args=(device, options.build_type)) |
| 37 p.start() | 38 p.start() |
| 38 procs += [p] | 39 procs += [p] |
| 39 | 40 |
| 40 for p in procs: | 41 for p in procs: |
| 41 p.join() | 42 p.join() |
| OLD | NEW |