Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(23)

Unified Diff: third_party/WebKit/LayoutTests/http/tests/security/cookies/websocket/third-party-cookie-accepted.html

Issue 2102993002: Fix WebSocket to set first party for cookies (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added TODO for mkwst Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/LayoutTests/http/tests/security/cookies/websocket/third-party-cookie-accepted.html
diff --git a/third_party/WebKit/LayoutTests/http/tests/security/cookies/websocket/third-party-cookie-accepted.html b/third_party/WebKit/LayoutTests/http/tests/security/cookies/websocket/third-party-cookie-accepted.html
new file mode 100644
index 0000000000000000000000000000000000000000..aad7eb7d550fb7c8345e39be74bc499c76acc946
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/http/tests/security/cookies/websocket/third-party-cookie-accepted.html
@@ -0,0 +1,37 @@
+<!DOCTYPE html>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="/websocket/resources/get-request-header.js"></script>
+<script src="/websocket/resources/cookie-test-util.js"></script>
+<script>
+if (window.testRunner) {
+ // Don't block third-party cookies.
+ testRunner.setAlwaysAcceptCookies(true);
+}
+
+const origin = WS_REMOTE_ORIGIN;
+
+async_test(t => {
+ setCookie(origin).then(
+ t.step_func(() => {
+ return connectAndGetRequestHeadersFrom(origin);
+ }),
+ t.unreached_func('Failed to set cookie.')
+ ).then(
+ t.step_func(headers => {
+ const cookie = headers['cookie'];
+ assert_not_equals(cookie, undefined,
+ 'headers should contain a cookie header.');
+ // Same-site cookies are not included.
+ assert_equals(normalizeCookie(cookie),
+ 'WK-WebSocket-test-path-pass=1; WK-WebSocket-test=1');
+ return clear(origin);
+ }),
+ t.unreached_func('Cookie header lookup failed.')
+ ).then(
+ t.done.bind(t),
+ t.unreached_func('Failed to clear cookies.')
+ );
+}, "Test that third-party cookies are accepted for WebSockets when blocking " +
+ "is disabled.");
+</script>

Powered by Google App Engine
This is Rietveld 408576698