summaryrefslogtreecommitdiffstats
path: root/chromium/tools/WebViewShell/run_startup_time_test.sh
blob: 7ddf83a025dabb0ceede5b9d8d2f7b30bee9fc09 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/bin/bash

if ! which adb &> /dev/null; then
  echo "adb is not in your path, did you run envsetup.sh?"
  exit -1
fi

TMPFILE=$(tempfile)
echo '<body><div>just some text</div></body>' > $TMPFILE
adb push $TMPFILE /data/local/tmp/file.html
rm $TMPFILE
adb shell am start -n com.android.htmlviewer/.HTMLViewerActivity -d "file:///data/local/tmp/file.html" -a VIEW -t "text/html"

sleep 3

echo 'Running test, you should run `adb logcat | grep WebViewStartupTimeMillis=` in another shell to see results.'
# Launch webview test shell 100 times
for i in $(seq 1 100); do
  if [[ $(($i % 10)) -eq 0 ]]; then
    echo -n "..$i.."
  fi
  adb shell kill -9 `adb shell ps | grep com.android.webview.chromium.shell | tr -s " " " " | cut -d" " -f2`
  adb shell am start -n com.android.webview.chromium.shell/.StartupTimeActivity -a VIEW > /dev/null
  sleep 0.5
done
echo

adb shell rm /data/local/tmp/file.html