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

Side by Side Diff: third_party/WebKit/LayoutTests/http/tests/websocket/cookie-ws-to-ws.html

Issue 2102993002: Fix WebSocket to set first party for cookies (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update testRunner calls to setBlockThirdPartyCookies() 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 unified diff | Download patch
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <script src="/js-test-resources/js-test.js"></script> 2 <script src="/js-test-resources/js-test.js"></script>
3 <script src="resources/get-request-header.js"></script> 3 <script src="resources/get-request-header.js"></script>
4 <script> 4 <script>
5 description('Test receiving cookies in a WebSocket handshake which were set by a nother WebSocket handshake.'); 5 description('Test receiving cookies in a WebSocket handshake which were set by a nother WebSocket handshake.');
6 6
7 window.jsTestIsAsync = true; 7 window.jsTestIsAsync = true;
8 8
9 // Normalize a cookie string 9 // Normalize a cookie string
10 function normalizeCookie(cookie) { 10 function normalizeCookie(cookie) {
11 // Split the cookie string, sort it and then put it back together. 11 // Split the cookie string, sort it and then put it back together.
12 return cookie.split('; ').sort().join('; '); 12 return cookie.split('; ').sort().join('; ');
13 } 13 }
14 14
15 var cookie; 15 var cookie;
16 var URL_SET_COOKIE = 'ws://127.0.0.1:8880/set-cookie'; 16 var URL_SET_COOKIE = 'ws://127.0.0.1:8880/set-cookie';
17 var ws_set_cookie = new WebSocket(URL_SET_COOKIE); 17 var ws_set_cookie = new WebSocket(URL_SET_COOKIE);
18 18
19 ws_set_cookie.onopen = function () { 19 ws_set_cookie.onopen = function () {
20 ws_set_cookie.close(); 20 ws_set_cookie.close();
21 }; 21 };
22 ws_set_cookie.onclose = function (e) { 22 ws_set_cookie.onclose = function (e) {
23 connectAndGetRequestHeader('cookie').then(function(value) { 23 connectAndGetRequestHeader('cookie').then(function(value) {
24 cookie = normalizeCookie(value); 24 cookie = normalizeCookie(value);
25 shouldBeEqualToString('cookie', 'ws-domain-local-ip=1; ws-path-root=1; w s=1'); 25 shouldBeEqualToString('cookie', 'same-site-lax=1; same-site-strict=1; ws -domain-local-ip=1; ws-path-root=1; ws=1');
26 clear(); 26 clear();
27 }, finishAsFailed); 27 }, finishAsFailed);
28 }; 28 };
29 29
30 function clear() { 30 function clear() {
31 var ws = new WebSocket(URL_SET_COOKIE + '?clear=1'); 31 var ws = new WebSocket(URL_SET_COOKIE + '?clear=1');
32 ws.onopen = function () { 32 ws.onopen = function () {
33 ws.close(); 33 ws.close();
34 }; 34 };
35 ws.onclose = finishJSTest; 35 ws.onclose = finishJSTest;
36 } 36 }
37 setTimeout(finishJSTest, 1000); 37 setTimeout(finishJSTest, 1000);
38 </script> 38 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698