OLD | NEW |
| (Empty) |
1 #!/bin/bash | |
2 | |
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 | |
5 # found in the LICENSE file. | |
6 | |
7 # Simple test launches a content shell to load a URL, and waits 5 seconds before | |
8 # checking there are two content shell processes (grep ps for 'content_shell'). | |
9 # If multiple devices are connected, the test runs on the first one listed by | |
10 # adb devices. The script expects your environment to already be set up. | |
11 | |
12 if [ $# -ne 1 ]; then | |
13 echo "Error: Please specify content shell location" | |
14 exit 1 | |
15 fi | |
16 | |
17 CONTENT_SHELL_APK=$1 | |
18 DEV=$(adb devices | grep device | grep -v devices | awk '{ print $1 }' \ | |
19 | head -n 1) | |
20 | |
21 if [[ -z $DEV ]]; then | |
22 echo "Error: No connected devices. Device needed to run content shell test." | |
23 exit 1 | |
24 fi | |
25 | |
26 # Reinstall content shell. This will also kill existing content_shell procs. | |
27 adb -s ${DEV} uninstall org.chromium.content_shell | |
28 | |
29 if [ ! -f "${CONTENT_SHELL_APK}" ]; then | |
30 echo "Error: Could not find specified content shell apk to install." | |
31 exit 1 | |
32 fi | |
33 adb -s ${DEV} install -r ${CONTENT_SHELL_APK} | |
34 | |
35 # Launch a content shell process to open about:version | |
36 adb -s ${DEV} shell am start -n \ | |
37 org.chromium.content_shell/.ContentShellActivity -d "about:version" | |
38 | |
39 # Wait 5 seconds, to give the content shell some time to crash. | |
40 sleep 5 | |
41 | |
42 # Get the number of content shell procs that exist. | |
43 NUM_PROCS=$(adb -s ${DEV} shell ps | grep content_shell | wc | awk '{print $1}') | |
44 | |
45 # Check that there are two content shell processes (browser and renderer). | |
46 if [[ "${NUM_PROCS}" -lt 2 ]]; then | |
47 echo "ERROR: Expected two content shell processes (browser and renderer)." | |
48 echo " Found ${NUM_PROCS} 'content_shell' process(es)." | |
49 # Uninstall content shell to clean up. | |
50 adb -s ${DEV} uninstall org.chromium.content_shell | |
51 exit 1 | |
52 fi | |
53 | |
54 # Uninstall content shell to clean up. | |
55 adb -s ${DEV} uninstall org.chromium.content_shell | |
OLD | NEW |