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

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

Issue 2163563002: Import normalizeCookies() from cookie-test-util.js (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 src="resources/cookie-test-util.js"></script>
4 <script> 5 <script>
5 description('Test receiving cookies in a WebSocket handshake which were set by a nother WebSocket handshake.'); 6 description('Test receiving cookies in a WebSocket handshake which were set by a nother WebSocket handshake.');
6 7
7 window.jsTestIsAsync = true; 8 window.jsTestIsAsync = true;
8 9
9 // Normalize a cookie string
10 function normalizeCookie(cookie) {
11 // Split the cookie string, sort it and then put it back together.
12 return cookie.split('; ').sort().join('; ');
13 }
14
15 var cookie; 10 var cookie;
16 var URL_SET_COOKIE = 'ws://127.0.0.1:8880/set-cookie'; 11 var URL_SET_COOKIE = 'ws://127.0.0.1:8880/set-cookie';
17 var ws_set_cookie = new WebSocket(URL_SET_COOKIE); 12 var ws_set_cookie = new WebSocket(URL_SET_COOKIE);
18 13
19 ws_set_cookie.onopen = function () { 14 ws_set_cookie.onopen = function () {
20 ws_set_cookie.close(); 15 ws_set_cookie.close();
21 }; 16 };
22 ws_set_cookie.onclose = function (e) { 17 ws_set_cookie.onclose = function (e) {
23 connectAndGetRequestHeader('cookie').then(function(value) { 18 connectAndGetRequestHeader('cookie').then(function(value) {
24 cookie = normalizeCookie(value); 19 cookie = normalizeCookie(value);
25 shouldBeEqualToString('cookie', 'same-site-lax=1; same-site-strict=1; ws -domain-local-ip=1; ws-path-root=1; ws=1'); 20 shouldBeEqualToString('cookie', 'same-site-lax=1; same-site-strict=1; ws -domain-local-ip=1; ws-path-root=1; ws=1');
26 clear(); 21 clear();
27 }, finishAsFailed); 22 }, finishAsFailed);
28 }; 23 };
29 24
30 function clear() { 25 function clear() {
31 var ws = new WebSocket(URL_SET_COOKIE + '?clear=1'); 26 var ws = new WebSocket(URL_SET_COOKIE + '?clear=1');
32 ws.onopen = function () { 27 ws.onopen = function () {
33 ws.close(); 28 ws.close();
34 }; 29 };
35 ws.onclose = finishJSTest; 30 ws.onclose = finishJSTest;
36 } 31 }
37 setTimeout(finishJSTest, 1000); 32 setTimeout(finishJSTest, 1000);
38 </script> 33 </script>
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698