| OLD | NEW |
| 1 #!/bin/bash | 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 CONTENT_SHELL_APK=${CHROME_SRC}/out/Release/content_shell/ContentShell-debug.apk | 7 from multiprocessing import Process |
| 8 import os |
| 8 | 9 |
| 9 if [ ! -f "${CONTENT_SHELL_APK}" ]; then | 10 from pylib import android_commands |
| 10 echo "Error: Could not find ${CONTENT_SHELL_APK} to install." | |
| 11 exit 1 | |
| 12 fi | |
| 13 | 11 |
| 14 DEVS=$(adb devices | grep device | grep -v devices | awk '{ print $1 }') | |
| 15 | 12 |
| 16 if [[ -z $DEVS ]]; then | 13 def InstallContentShell(device): |
| 17 echo "Error: No connected devices. Device needed to run content shell test." | 14 apk_path = os.path.join(os.environ['CHROME_SRC'], |
| 18 exit 1 | 15 'out/Release/content_shell/ContentShell-debug.apk') |
| 19 fi | 16 result = android_commands.AndroidCommands(device=device).ManagedInstall( |
| 17 apk_path, False, 'org.chromium.content_shell') |
| 18 print '----- Installed on %s -----' % device |
| 19 print result |
| 20 | 20 |
| 21 for DEV in ${DEVS}; do | 21 |
| 22 # Reinstall content shell. This will also kill existing content_shell procs. | 22 devices = android_commands.GetAttachedDevices() |
| 23 echo "Installing ${CONTENT_SHELL_APK} in ${DEV}" | 23 if not devices: |
| 24 adb -s ${DEV} uninstall org.chromium.content_shell | 24 raise Exception('Error: no connected devices') |
| 25 adb -s ${DEV} install -r ${CONTENT_SHELL_APK} | 25 |
| 26 done | 26 procs = [] |
| 27 for device in devices: |
| 28 p = Process(target=InstallContentShell, args=(device,)) |
| 29 p.start() |
| 30 procs += [p] |
| 31 |
| 32 for p in procs: |
| 33 p.join() |
| OLD | NEW |