Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / android_webview / tools / WebViewShell / run_startup_time_test.sh
blob50ac7f3bfeec99002374141ab2dff8d9507c3616
1 #!/bin/bash
3 # Copyright 2015 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.
7 if ! which adb &> /dev/null; then
8 echo "adb is not in your path, did you run envsetup.sh?"
9 exit -1
12 TMPFILE=$(tempfile)
13 echo '<body><div>just some text</div></body>' > $TMPFILE
14 adb push $TMPFILE /data/local/tmp/file.html
15 rm $TMPFILE
16 adb shell am start -n com.android.htmlviewer/.HTMLViewerActivity -d \
17 "file:///data/local/tmp/file.html" -a VIEW -t "text/html"
19 sleep 3
21 echo 'Running test, you should run \
22 `adb logcat | grep WebViewStartupTimeMillis=` in another shell to see results.'
24 # Launch webview test shell 100 times
25 for i in $(seq 1 100); do
26 if [[ $(($i % 10)) -eq 0 ]]; then
27 echo -n "..$i.."
29 adb shell kill -9 `adb shell ps | grep org.chromium.webview_shell \
30 | tr -s " " " " | cut -d" " -f2`
31 adb shell am start -n org.chromium.webview_shell/.StartupTimeActivity \
32 -a VIEW > /dev/null
33 sleep 0.5
34 done
35 echo
37 adb shell rm /data/local/tmp/file.html