-
Notifications
You must be signed in to change notification settings - Fork 19
/
chrome_launcher.sh
123 lines (112 loc) · 6.25 KB
/
chrome_launcher.sh
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
#!/bin/bash
# Download Extension
extension_setup() {
ps_analysis_tool_version=v0.9.0
extension_dir="/var/tmp"
cd $extension_dir
if [ ! -d $extension_dir/ps-analysis-tool-$ps_analysis_tool_version ]; then
mkdir -p $extension_dir/ps-analysis-tool-$ps_analysis_tool_version
curl -L -O -s https://github.com/GoogleChromeLabs/ps-analysis-tool/releases/download/$ps_analysis_tool_version/extension-$ps_analysis_tool_version.zip
unzip -qo extension-$ps_analysis_tool_version.zip -d $extension_dir/ps-analysis-tool-$ps_analysis_tool_version
fi
cd -
}
# Detect OS
if [[ "$(uname)" == "Darwin" ]]; then
# Loads Chrome with a temporary profile that is deleted after Chrome is closed
launch_chrome() {
local CHROME_PATH="/Applications/Google Chrome.app"
local DATA_DIR="$(mktemp -d '/tmp/chrome_data_dir.XXXXXXXXXX')"
open -W -na "${CHROME_PATH}" --args \
--disable-sync \
--no-default-browser-check \
--no-first-run \
--start-maximized \
--user-data-dir="${DATA_DIR}" \
--silent-debugger-extension-api \
"$@" "https://example.com/?psat_cdp=on&psat_multitab=on" >/dev/null 2>&1 && rm -rf "${DATA_DIR}" &
}
elif [[ "$(uname)" == "Linux" ]]; then
# Loads Chrome with a temporary profile that is deleted after Chrome is closed
launch_chrome() {
local CHROME="google-chrome"
local DATA_DIR="$(mktemp -d '/tmp/chrome_data_dir.XXXXXXXXXX')"
"${CHROME}" \
--disable-sync \
--no-default-browser-check \
--no-first-run \
--start-maximized \
--user-data-dir="${DATA_DIR}" \
--silent-debugger-extension-api \
"$@" "https://example.com/?psat_cdp=on&psat_multitab=on" >/dev/null 2>&1 && rm -rf "${DATA_DIR}" &
}
fi
# Launch default chrome
chrome-default() {
launch_chrome \
--install-autogenerated-theme='255,51,51'
}
# Launch default chrome with 3rd Party Cookie Phaseout
chrome-3pcd() {
launch_chrome \
--install-autogenerated-theme='150,220,150' \
--test-third-party-cookie-phaseout \
--enable-features="FirstPartySets,StorageAccessAPI,StorageAccessAPIForOriginExtension,PageInfoCookiesSubpage,PrivacySandboxFirstPartySetsUI,TpcdMetadataGrants,TpcdSupportSettings,TpcdHeuristicsGrants:TpcdReadHeuristicsGrants/true/TpcdWritePopupCurrentInteractionHeuristicsGrants/30d/TpcdBackfillPopupHeuristicsGrants/30d/TpcdPopupHeuristicEnableForIframeInitiator/all/TpcdWriteRedirectHeuristicGrants/15m/TpcdRedirectHeuristicRequireABAFlow/true/TpcdRedirectHeuristicRequireCurrentInteraction/true"
}
# Launch default chrome with Privacy Sandbox extension
chrome-default-ps() {
extension_setup
launch_chrome \
--install-autogenerated-theme='255,51,51' \
--load-extension="$extension_dir/ps-analysis-tool-$ps_analysis_tool_version/extension/"
}
# Launch default chrome with 3rd Party Cookie Phaseout with Privacy Sandbox extension
chrome-3pcd-ps() {
extension_setup
launch_chrome \
--install-autogenerated-theme='150,220,150' \
--test-third-party-cookie-phaseout \
--load-extension="$extension_dir/ps-analysis-tool-$ps_analysis_tool_version/extension" \
--enable-features="FirstPartySets,StorageAccessAPI,StorageAccessAPIForOriginExtension,PageInfoCookiesSubpage,PrivacySandboxFirstPartySetsUI,TpcdMetadataGrants,TpcdSupportSettings,TpcdHeuristicsGrants:TpcdReadHeuristicsGrants/true/TpcdWritePopupCurrentInteractionHeuristicsGrants/30d/TpcdBackfillPopupHeuristicsGrants/30d/TpcdPopupHeuristicEnableForIframeInitiator/all/TpcdWriteRedirectHeuristicGrants/15m/TpcdRedirectHeuristicRequireABAFlow/true/TpcdRedirectHeuristicRequireCurrentInteraction/true"
}
# Launch default chrome with Partitioned Cookies
chrome-chip() {
launch_chrome \
--partitioned-cookies=true
}
# Launch Chrome with 3rd Party Cookie Phaseout with demo domains specified as related websites
chrome-rws() {
launch_chrome \
--install-autogenerated-theme='150,220,150' \
--test-third-party-cookie-phaseout \
--use-related-website-set="{\"primary\": \"https://domain-aaa.com\", \"associatedSites\": [\"https://domain-bbb.com\", \"https://domain-ccc.com\"]}" \
--enable-features="FirstPartySets,StorageAccessAPI,StorageAccessAPIForOriginExtension,PageInfoCookiesSubpage,PrivacySandboxFirstPartySetsUI,TpcdMetadataGrants,TpcdSupportSettings,TpcdHeuristicsGrants:TpcdReadHeuristicsGrants/true/TpcdWritePopupCurrentInteractionHeuristicsGrants/30d/TpcdBackfillPopupHeuristicsGrants/30d/TpcdPopupHeuristicEnableForIframeInitiator/all/TpcdWriteRedirectHeuristicGrants/15m/TpcdRedirectHeuristicRequireABAFlow/true/TpcdRedirectHeuristicRequireCurrentInteraction/true"
}
# Launch Chrome with 3rd Party Cookie Phaseout with demo domains specified as related websites with Privacy Sandbox extension
chrome-rws-ps() {
extension_setup
launch_chrome \
--install-autogenerated-theme='150,220,150' \
--test-third-party-cookie-phaseout \
--use-related-website-set="{\"primary\": \"https://domain-aaa.com\", \"associatedSites\": [\"https://domain-bbb.com\", \"https://domain-ccc.com\"]}" \
--load-extension="$extension_dir/ps-analysis-tool-$ps_analysis_tool_version/extension" \
--enable-features="FirstPartySets,StorageAccessAPI,StorageAccessAPIForOriginExtension,PageInfoCookiesSubpage,PrivacySandboxFirstPartySetsUI,TpcdMetadataGrants,TpcdSupportSettings,TpcdHeuristicsGrants:TpcdReadHeuristicsGrants/true/TpcdWritePopupCurrentInteractionHeuristicsGrants/30d/TpcdBackfillPopupHeuristicsGrants/30d/TpcdPopupHeuristicEnableForIframeInitiator/all/TpcdWriteRedirectHeuristicGrants/15m/TpcdRedirectHeuristicRequireABAFlow/true/TpcdRedirectHeuristicRequireCurrentInteraction/true"
}
# Launch Private Advertising Testing Chrome
chrome-pat() {
launch_chrome \
--install-autogenerated-theme='0,53,102' \
--test-third-party-cookie-phaseout \
--enable-features="PrivacySandboxAdsAPIs,PrivacySandboxAdsAPIsOverride" \
--enable-privacy-sandbox-ads-apis
}
# Launch Private Advertising Testing Chrome with Privacy Sandbox extension
chrome-pat-ps() {
extension_setup
launch_chrome \
--install-autogenerated-theme='0,53,102' \
--load-extension="$extension_dir/ps-analysis-tool-$ps_analysis_tool_version/extension" \
--test-third-party-cookie-phaseout \
--enable-features="PrivacySandboxAdsAPIs,PrivacySandboxAdsAPIsOverride" \
--enable-privacy-sandbox-ads-apis
}