Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / inspector / cookie-parser.html
blobb6f57282124749b62ce8149587dbadd5dd775d54
1 <html>
2 <head>
3 <script src="../http/tests/inspector/inspector-test.js"></script>
4 <script type="text/javascript">
6 function initialize_CookieTests()
9 InspectorTest.dumpCookie = function(cookie)
11 var requestDate = new Date("Mon Oct 18 2010 17:00:00 GMT+0000");
12 var expires = cookie.expiresDate(requestDate);
14 var output = "name: " + cookie.name() + ", value: " + cookie.value() + ", httpOnly: " + cookie.httpOnly() +
15 ", first-party-only: " + cookie.firstPartyOnly() + ", secure: " + cookie.secure() +
16 ", session: " + cookie.session() + ", path: " + cookie.path() +
17 ", domain: " + cookie.domain() + ", port: " + cookie.port() +
18 ", expires: " + (expires ? expires.getTime() : "n/a") +
19 ", size: " + cookie.size();
21 InspectorTest.addResult(output);
22 InspectorTest.addObject(cookie.attributes());
25 InspectorTest.dumpCookies = function(cookies)
27 for (var i = 0; i < cookies.length; ++i)
28 InspectorTest.dumpCookie(cookies[i]);
31 InspectorTest.parseAndDumpCookie = function(header)
33 var parser = new WebInspector.CookieParser();
34 InspectorTest.addResult("source: " + header);
35 InspectorTest.dumpCookies(parser.parseCookie(header));
38 InspectorTest.parseAndDumpSetCookie = function(header)
40 var parser = new WebInspector.CookieParser();
41 InspectorTest.addResult("source: " + header);
42 InspectorTest.dumpCookies(parser.parseSetCookie(header));
47 var test = function()
49 InspectorTest.parseAndDumpCookie("cookie=value");
50 InspectorTest.parseAndDumpCookie("$version=1; a=b,c = d, e=f");
51 InspectorTest.parseAndDumpCookie("$version=1; a=b;c = d; e =f");
52 InspectorTest.parseAndDumpCookie("cooke1 = value1; another cookie = another value");
53 InspectorTest.parseAndDumpCookie("cooke1 = value; $Path=/; $Domain=.example.com;");
54 InspectorTest.parseAndDumpCookie("cooke1 = value; $Path=/; $Domain=.example.com ; Cookie2 = value2; $Path = /foo; $DOMAIN = foo.example.com;");
55 InspectorTest.parseAndDumpCookie("cooke1 = value; $Path=/; $Domain=.example.com\nCookie2 = value2; $Path = /foo; $DOMAIN = foo.example.com; ");
56 InspectorTest.parseAndDumpCookie("$version =1; cooke1 = value; $Path=/; $Domain =.example.com; \n Cookie2 = value2; $Path = /foo; $DOMAIN = foo.example.com;");
58 InspectorTest.parseAndDumpSetCookie("cookie=value");
59 InspectorTest.parseAndDumpSetCookie("a=b\n c=d\n f");
60 InspectorTest.parseAndDumpSetCookie("cooke1 = value; Path=/; Domain=.example.com;");
61 InspectorTest.parseAndDumpSetCookie("cooke1 = value; Path=/; Domain= .example.com \nCookie2 = value2; Path = /foo; Domain = foo.example.com");
62 InspectorTest.parseAndDumpSetCookie("cooke1 = value; expires = Mon, Oct 18 2010 17:00 GMT+0000; Domain =.example.com\nCookie2 = value2; Path = /foo; DOMAIN = foo.example.com; HttpOnly; Secure; Discard;");
63 InspectorTest.parseAndDumpSetCookie("cooke1 = value; max-age= 1440; Domain =.example.com\n Cookie2 = value2; Path = /foo; DOMAIN = foo.example.com; HttpOnly; Secure; Discard;");
64 InspectorTest.parseAndDumpSetCookie("cooke1 = value; HttpOnly; Secure; First-Party-Only;");
65 InspectorTest.parseAndDumpSetCookie("cooke1; Path=/; Domain=.example.com;");
66 InspectorTest.parseAndDumpSetCookie("cooke1=; Path=/; Domain=.example.com;");
67 InspectorTest.completeTest();
70 </script>
71 </head>
72 <body onload="runTest()">
73 <p>Tests inspector cookie parser</p>
74 </body>
75 </html>