Chromium Code Reviews| Index: third_party/WebKit/LayoutTests/http/tests/security/cookies/websocket/first-party-cookie-accepted.html |
| diff --git a/third_party/WebKit/LayoutTests/http/tests/security/cookies/websocket/first-party-cookie-accepted.html b/third_party/WebKit/LayoutTests/http/tests/security/cookies/websocket/first-party-cookie-accepted.html |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..92fec64b5bf36914a7a50201c1f398c3e39b2fed |
| --- /dev/null |
| +++ b/third_party/WebKit/LayoutTests/http/tests/security/cookies/websocket/first-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) { |
| + // Block third-party cookies. |
| + testRunner.setAlwaysAcceptCookies(false); |
| +} |
| + |
| +const origin = WS_ORIGIN; |
| + |
| +async_test(t => { |
|
yhirano
2016/07/06 11:19:08
[optional] I prefer promise_test to async_test if
tyoshino (SeeGerritForStatus)
2016/07/07 07:00:44
Changed
|
| + 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.'); |
| + assert_equals( |
| + normalizeCookie(cookie), |
| + 'WK-WebSocket-test-domain-pass=1; WK-WebSocket-test-path-pass=1; ' + |
| + 'WK-WebSocket-test=1; same-site-lax=1; same-site-strict=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 first-party cookies not blocked for WebSockets."); |
| +</script> |