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

Side by Side Diff: third_party/polymer/components/web-animations-js/tools/android/setup.sh

Issue 592603004: Revert "Polymer elements added to third_party/polymer." (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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
OLDNEW
(Empty)
1 #! /bin/bash
2
3 # Create the Android environment needed by run-tests.py
4 set -e
5 ANDROID_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
6 . $ANDROID_DIR/config.sh
7 cd $ANDROID_DIR
8
9 # Download the android emulator and adb
10 if [ ! -d adt ]; then
11 wget -c https://dl.google.com/android/adt/adt-bundle-linux-$(uname -p)-2013103 0.zip -O adt.zip
12 unzip adt.zip > /dev/null
13 ls -l adt*
14 mv adt-bundle-linux-* adt
15 fi
16 export ADB="$ANDROID_DIR/adt/sdk/platform-tools/adb -e"
17 export EMULATOR=$ANDROID_DIR/adt/sdk/tools/emulator
18 export AVD=$ANDROID_DIR/adt/sdk/tools/android
19
20 # Create an Android Virtual Device
21 if [ ! -e avd ]; then
22 echo "" | $AVD --verbose create avd -n Android-Chrome --target 1 --force --pat h avd
23 fi
24
25 # See if the emulator is running? The emulator occasionally segfaults when
26 # starting, so we try this in a loop.
27 while true; do
28 EMULATOR_RUNNING=false
29 if [ -e $EMULATOR_PIDFILE ]; then
30 EMULATOR_PID=$(cat $EMULATOR_PIDFILE)
31 if kill -0 $EMULATOR_PID ; then
32 EMULATOR_RUNNING=true
33 else
34 rm $EMULATOR_PIDFILE
35 fi
36 fi
37 if $EMULATOR_RUNNING ; then
38 echo "Android emulator running at $EMULATOR_PID"
39 else
40 # The emulator needs an xserver, start xvfb if none are running.
41 if [ "x$DISPLAY" == x ]; then
42 export DISPLAY=:99.0
43 # xvfb must use 24bits otherwise you get a "failed to create drawable" err or
44 # from the emulator. See the following bug for more information
45 # https://bugs.freedesktop.org/show_bug.cgi?id=62742
46 /sbin/start-stop-daemon --start --quiet --pidfile $XVFB_PIDFILE --make-pid file --background --exec \
47 /usr/bin/Xvfb -- :99 +extension GLX -ac -screen 0 1280x1024x24
48 sleep 15
49 fi
50
51 $ADB kill-server
52 $ADB start-server
53 if [ $($ADB devices | wc -l) -gt 2 ]; then
54 echo "Multiple Android devices found, bailing."
55 exit 1
56 fi
57 # "-no-snapshot-save -wipe-data" is needed so not state is saved.
58 # "-gpu on" is needed as Chrome segfaults without a GPU.
59 /sbin/start-stop-daemon --verbose --start --quiet --pidfile $EMULATOR_PIDFIL E --make-pidfile --background --exec /bin/bash -- -c \
60 "exec $EMULATOR -verbose -gpu on -no-audio -no-boot-anim -partition-size 1 024 -no-snapshot-save -wipe-data @Android-Chrome >> $OLD_PWD/emulator.log 2>&1"
61
62 # The emulator crashes if you access it too fast :/
63 sleep 5
64 continue
65 fi
66
67 $ADB wait-for-device shell true
68
69 BOOTED=$($ADB shell getprop sys.boot_completed | sed -e's/[^0-9]*//g')
70 BOOTANIM=$($ADB shell getprop init.svc.bootanim | sed -e's/[^a-zA-Z]*//g')
71 echo "Waiting for emulator to boot... Booted? $BOOTED Animation? $BOOTANIM"
72
73 if [ x$BOOTED == x1 -a x$BOOTANIM == xstopped ]; then
74
75 # Make localhost refer to the host machine, not the emulator.
76 # See http://developer.android.com/tools/devices/emulator.html#emulatornetwo rking
77 echo "Redirecting localhost"
78 $ADB shell mount -o remount,rw -t yaffs2 /dev/block/mtdblock0 /system
79 $ADB shell echo "10.0.2.2 localhost" \> /etc/hosts
80
81 break
82 else
83 sleep 5
84 fi
85 done
86
87 # Download and install the chrome apk.
88 if [ -e Chrome.apk ]; then
89 CHROME_APK=$ANDROID_DIR/Chrome.apk
90 CHROME_APP=com.google.android.apps.chrome
91 CHROME_ACT=.Main
92 else
93 if [ ! -e chrome-android/apks/ChromeShell.apk ]; then
94 LATEST_APK=`curl -s http://commondatastorage.googleapis.com/chromium-browser -continuous/Android/LAST_CHANGE`
95 REMOTE_APK=http://commondatastorage.googleapis.com/chromium-browser-continuo us/Android/$LATEST_APK/chrome-android.zip
96 wget -c $REMOTE_APK
97 unzip chrome-android.zip
98 fi
99 CHROME_APK=$ANDROID_DIR/chrome-android/apks/ChromeShell.apk
100 CHROME_APP=org.chromium.chrome.shell
101 CHROME_ACT=.ChromeShellActivity
102 fi
103
104 function start_chrome () {
105 $ADB shell am start -a android.intent.action.MAIN -n $CHROME_APP/$CHROME_ACT - W
106 }
107
108 if start_chrome | grep -q "does not exist"; then
109 $ADB install $CHROME_APK
110 fi
111
112 # Check the chrome binary actually starts without segfaulting
113 start_chrome
114 sleep 2
115 if start_chrome | grep -q "its current task has been brought to the front"; then
116 echo "Chrome seems to have started okay."
117 else
118 echo "Chrome seems to have crashed!"
119 $ADB shell dumpsys activity # FIXME: Need to grep for running Chrome.
120 exit 1
121 fi
122
123
124 # Download and start the chromedriver binary
125 if [ ! -e chromedriver ]; then
126 # TODO: Use the latest release of chromedriver instead of this custom build on ce version 3.0 comes out.
127 # LATEST_CHROMEDRIVER=`curl -s http://chromedriver.storage.googleapis.com/LATE ST_RELEASE`
128 # wget -c http://chromedriver.storage.googleapis.com/$LATEST_CHROMEDRIVER/chro medriver_linux64.zip -O chromedriver.zip
129 # unzip chromedriver.zip
130
131 # This version of chromedriver was build from the Chromium repository at r2626 39 on 2014-04-09.
132 wget https://googledrive.com/host/0B6C-LL9qmW-IYVFrdURCMHZlM1U -O chromedriver
133 chmod 0755 chromedriver
134 fi
135
136 CHROMEDRIVER_NOTRUNNING=true
137 if [ -e $CHROMEDRIVER_PIDFILE ]; then
138 CHROMEDRIVER_PID=$(cat $CHROMEDRIVER_PIDFILE)
139 if kill -0 $CHROMEDRIVER_PID ; then
140 echo "Chrome Driver running at $CHROMEDRIVER_PID"
141 CHROMEDRIVER_NOTRUNNING=false
142 else
143 rm $CHROMEDRIVER_PIDFILE
144 fi
145 fi
146 if $CHROMEDRIVER_NOTRUNNING; then
147 /sbin/start-stop-daemon --verbose --start --quiet --pidfile $CHROMEDRIVER_PIDF ILE --make-pidfile --background --exec \
148 $ANDROID_DIR/chromedriver
149 sleep 5
150 fi
151
152 cd $OLD_PWD
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698