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

Unified Diff: third_party/WebKit/LayoutTests/http/tests/security/cookies/websocket/first-party-cookie-not-blocked.html

Issue 2102993002: Fix WebSocket to set first party for cookies (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: a Created 4 years, 6 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/first-party-cookie-not-blocked.html
diff --git a/third_party/WebKit/LayoutTests/http/tests/security/cookies/websocket/first-party-cookie-not-blocked.html b/third_party/WebKit/LayoutTests/http/tests/security/cookies/websocket/first-party-cookie-not-blocked.html
new file mode 100644
index 0000000000000000000000000000000000000000..a83d96cb21ef3c9b7568d64744c413aeb7db278e
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/http/tests/security/cookies/websocket/first-party-cookie-not-blocked.html
@@ -0,0 +1,37 @@
+<!DOCTYPE html>
+<script src="/js-test-resources/testharness.js"></script>
+<script src="/js-test-resources/testharnessreport.js"></script>
Mike West 2016/06/28 11:25:37 Nit: Just `/resources/`
tyoshino (SeeGerritForStatus) 2016/06/30 08:24:13 Oh. It's no longer preferred? Done.
+<script src="../../../websocket/resources/get-request-header.js"></script>
+<script src="../../../websocket/resources/cookie-test-util.js"></script>
Mike West 2016/06/28 11:25:37 Nit: I think that just `/websocket` is a little si
tyoshino (SeeGerritForStatus) 2016/06/30 08:24:13 Done. Yeah, I often use relative path so that we c
+<script>
+if (window.testRunner) {
+ // Block third-party cookies.
+ testRunner.setAlwaysAcceptCookies(false);
Mike West 2016/06/28 11:25:37 Nit: Would you mind filing a bug to rename this? I
tyoshino (SeeGerritForStatus) 2016/06/30 08:24:13 Created crbug.com/624711
+}
+
+var test = async_test('Test first-party cookie is not blocked for WebSocket');
Mike West 2016/06/28 11:25:37 Style nit: I usually end up writing this as: ```
tyoshino (SeeGerritForStatus) 2016/06/30 08:24:13 Yeah, sorry. I've been a bit away from layout test
+
+test.step(() => {
+ setCookie(SAME_ORIGIN_WS_SERVER).then(
+ test.step_func(() => {
+ return connectAndGetRequestHeadersFrom(SAME_ORIGIN_WS_SERVER);
+ }),
+ test.unreached_func('Failed to set cookie.')
+ ).then(
+ test.step_func(headers => {
+ const cookie = headers['cookie'];
+ assert_not_equals(cookie, undefined,
+ 'headers should contain a cookie header.');
+ assert_equals(
+ normalizeCookie(cookie),
+ 'WK-WebSocket-test-domain-pass=1; WK-WebSocket-test-path-pass=1; ' +
+ 'WK-WebSocket-test=1');
+ return clear(SAME_ORIGIN_WS_SERVER);
+ }),
+ test.unreached_func('cookie header lookup failed.')
+ ).then(
+ test.done.bind(test),
+ test.unreached_func('Failed to clear cookies.')
+ );
+});
+</script>

Powered by Google App Engine
This is Rietveld 408576698