summaryrefslogtreecommitdiffstats
path: root/tests/selenium/website_testbed
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 19:47:39 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 19:47:39 +0000
commit8d13bdc6cac0e20c43c6f909fc0208774b9c5c84 (patch)
tree5fd46925c6b4a881c9208772ed8e5cc0588bc164 /tests/selenium/website_testbed
parentInitial commit. (diff)
downloadprivacybadger-upstream.tar.xz
privacybadger-upstream.zip
Adding upstream version 2020.10.7.upstream/2020.10.7upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/selenium/website_testbed')
-rw-r--r--tests/selenium/website_testbed/first-party.html13
-rw-r--r--tests/selenium/website_testbed/first-party.js25
2 files changed, 38 insertions, 0 deletions
diff --git a/tests/selenium/website_testbed/first-party.html b/tests/selenium/website_testbed/first-party.html
new file mode 100644
index 0000000..13713c4
--- /dev/null
+++ b/tests/selenium/website_testbed/first-party.html
@@ -0,0 +1,13 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <script src=first-party.js></script>
+ </head>
+ <body>
+ <p>Welcome to the cookie tracker test site. I'm creating a localcookie for this domain.
+ </p>
+ <button id="newwindowbutton" class="button" onClick="window.open();">Click this button to open a new window</button>
+ <p>I feel like iframing in a third party website:</p>
+ <iframe src="https://efforg.github.io/privacybadger-test-fixtures/html/cookie_frame.html" width="200" height="200">where's my iframe?</iframe>
+ </body>
+</html>
diff --git a/tests/selenium/website_testbed/first-party.js b/tests/selenium/website_testbed/first-party.js
new file mode 100644
index 0000000..7fdebe8
--- /dev/null
+++ b/tests/selenium/website_testbed/first-party.js
@@ -0,0 +1,25 @@
+function setExpire() {
+ var now = new Date();
+ var time = now.getTime();
+ var expireTime = time + 864000;
+ now.setTime(expireTime);
+ return ";expires=" + now.toGMTString();
+}
+
+function setPath() {
+ return ";path=/";
+}
+
+function setSameSite() {
+ return ";SameSite=None;Secure";
+}
+
+function updateCookie() {
+ var oldcookie = document.cookie;
+ var val = "1234567890";
+ console.log("read cookie: " + oldcookie);
+ document.cookie = "localtest=" + encodeURIComponent(val) + setExpire() + setPath() + setSameSite();
+ console.log("updating cookie to:" + document.cookie);
+}
+
+updateCookie();