#!/bin/bash

ecdnCustomerId="CUSTOMER_ID" # Replace CUSTOMER_ID with you actual customer Id
scenarioDuration=86400
pageURL="https://st-sdk.ecdn.teams.microsoft.com/?customerId=${ecdnCustomerId}&adapterId=Bash"
tempProfileDir="${HOME}/Library/Application Support/Google/ChromePeer5Temp"

"/Applications/Google Chrome.app/Contents/MacOS/Google Chrome" "$pageURL" --disable-gpu --disable-backgrounding-occluded-windows --disable-background-media-suspend --disable-renderer-backgrounding --headless --remote-debugging-port=0 --user-data-dir="$tempProfileDir" --autoplay-policy=no-user-gesture-required --disable-gesture-requirement-for-media-playback --disable-background-networking --disable-background-timer-throttling --disable-breakpad --disable-client-side-phishing-detection --disable-default-apps --disable-dev-shm-usage --disable-extensions --disable-field-trial-config --disable-features=site-per-process,WebRtcHideLocalIpsWithMdns --disable-hang-monitor --disable-popup-blocking --disable-prompt-on-repost --disable-sync --disable-translate --metrics-recording-only --no-first-run --safebrowsing-disable-auto-update --enable-automation --password-store=basic --use-mock-keychain --mute-audio &
pid=$!
echo "Started Chrome process, with id: ${pid}"
trap "kill -15 $pid" exit
sleep $scenarioDuration
kill -15 $pid
echo "Stopped Chrome process"
