Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / http / tests / websocket / cookie-http-to-ws.pl
bloba7e64ed401d4aaddc9a7d60b527cdb60e235db6d
1 #!/usr/bin/perl -wT
2 use strict;
4 my $originPath = $ENV{"SCRIPT_NAME"};
6 if ($ENV{"QUERY_STRING"} eq "clear=1") {
7 print "Content-Type: text/plain\r\n",
8 "Set-Cookie: WK-websocket-test-path=0; Path=$originPath; Max-Age=0\r\n",
9 "Set-Cookie: WK-websocket-test-domain=0; Path=/; Domain=127.0.0.1; Max-Age=0\r\n",
10 "\r\n",
11 "Cookies are cleared.";
12 exit;
15 print "Content-Type: text/html\r\n",
16 # Test that even if the "Path" attribute of a cookie matches the path of the
17 # origin document, the cookie won't be sent in the WebSocket handshake unless
18 # the "Path" attribute matches the WebSocket URL.
19 "Set-Cookie: WK-websocket-test-path=1; Path=$originPath\r\n",
20 # Test that if the "Path" and "Domain" matches the WebSocket URL, the cookie
21 # will be sent in the WebSocket handshake. "Path" is set to / so that the
22 # WebSocket created below can pass "Path" check so that we can test that
23 # "Domain" checking is working.
24 "Set-Cookie: WK-websocket-test-domain=1; Path=/; Domain=127.0.0.1\r\n",
25 "\r\n";
26 print <<'HTML';
27 <script src="/js-test-resources/js-test.js"></script>
28 <script src="resources/get-request-header.js"></script>
29 <script>
30 description('Test how WebSocket handles cookies with cookie attributes.');
32 window.jsTestIsAsync = true;
34 // Normalize a cookie string
35 function normalizeCookie(cookie)
37 // Split the cookie string, sort it and then put it back together.
38 return cookie.split('; ').sort().join('; ');
41 function clearCookies()
43 return new Promise(function(resolve, reject)
45 var xhr = new XMLHttpRequest();
46 xhr.open("GET", "cookie-http-to-ws.pl?clear=1");
47 xhr.onreadystatechange = function()
49 if (xhr.readyState == 4) {
50 resolve();
53 xhr.send(null);
54 });
57 var cookie = normalizeCookie(document.cookie);
59 shouldBeEqualToString('cookie', 'WK-websocket-test-domain=1; WK-websocket-test-path=1');
61 connectAndGetRequestHeader('cookie').then(function(value)
63 cookie = value;
64 shouldBeEqualToString('cookie', 'WK-websocket-test-domain=1');
65 clearCookies().then(finishJSTest);
66 }, finishAsFailed);
67 </script>
68 HTML