Home | History | Annotate | Download | only in tools
      1 #! /bin/sh
      2 
      3 # Copyright 2018 Google Inc.
      4 # Use of this source code is governed by a BSD-style license that can be
      5 # found in the LICENSE file.
      6 
      7 if [ "$(uname)" = Linux ]; then
      8   EXAMPLE='/opt/google/chrome/chrome'
      9 elif [ "$(uname)" = Darwin ]; then
     10   EXAMPLE='"/Applications/Google Chrome.app/Contents/MacOS/Google Chrome"'
     11 else
     12   EXAMPLE='"/c/Program Files (x86)/Google/Chrome/Application/chrome.exe"'
     13 fi
     14 
     15 if [ $# -ne 3 ] || ! [ -x "$1" ]; then
     16     cat >&2 << EOF
     17 usage:
     18   $0 CHROMIUM_BINARY SOURCE_URL DESTINATION_PATH
     19 e.g:
     20   $0 $EXAMPLE https://www.google.com/ /tmp/foo.mskp
     21 EOF
     22   exit 1
     23 fi
     24 
     25 EXE="$1"
     26 URL="$2"
     27 DST="$3"
     28 
     29 CRASH=~/tmp/headless_crash_dumps
     30 mkdir -p "$CRASH"
     31 
     32 printf 'chrome.gpuBenchmarking.printPagesToSkPictures("%s");\nquit\n' "$DST" | \
     33   "$EXE" --headless --disable-gpu --repl -crash-dumps-dir="$CRASH" \
     34      --no-sandbox --enable-gpu-benchmarking "$URL"
     35