Unreviewed, GTK css2.1 rebaseline after r101343.
[WebKit-https.git] / LayoutTests / inspector / cookie-parser.html
1 <html>
2 <head>
3 <script src="../http/tests/inspector/inspector-test.js"></script>
4 <script type="text/javascript">
5
6 function initialize_CookieTests()
7 {
8
9 InspectorTest.dumpCookie = function(cookie)
10 {
11     var requestDate = new Date("Mon Oct 18 2010 17:00:00 GMT+0000");
12     var expires = cookie.expires(requestDate);
13
14     var output = "name: " + cookie.name + ", value: " + cookie.value + ", httpOnly: " + cookie.httpOnly +
15         ", secure: " + cookie.secure + ", session: " + cookie.session + ", path: " + cookie.path +
16         ", domain: " + cookie.domain + ", port: " + cookie.port +
17         ", expires: " + (expires ? expires.getTime() : "n/a") +
18         ", size: " + cookie.size;
19
20     InspectorTest.addResult(output);
21     InspectorTest.addObject(cookie.attributes);
22 }
23
24 InspectorTest.dumpCookies = function(cookies)
25 {
26     for (var i = 0; i < cookies.length; ++i)
27         InspectorTest.dumpCookie(cookies[i]);
28 }
29
30 InspectorTest.parseAndDumpCookie = function(header)
31 {
32     var parser = new WebInspector.CookieParser();
33     InspectorTest.addResult("source: " + header);
34     InspectorTest.dumpCookies(parser.parseCookie(header));
35 }
36
37 InspectorTest.parseAndDumpSetCookie = function(header)
38 {
39     var parser = new WebInspector.CookieParser();
40     InspectorTest.addResult("source: " + header);
41     InspectorTest.dumpCookies(parser.parseSetCookie(header));
42 }
43
44 }
45
46 var test = function()
47 {
48     InspectorTest.parseAndDumpCookie("cookie=value");
49     InspectorTest.parseAndDumpCookie("$version=1; a=b,c  =   d, e=f");
50     InspectorTest.parseAndDumpCookie("$version=1; a=b;c  =   d; e =f");
51     InspectorTest.parseAndDumpCookie("cooke1 = value1; another cookie = another value");
52     InspectorTest.parseAndDumpCookie("cooke1 = value; $Path=/; $Domain=.example.com;");
53     InspectorTest.parseAndDumpCookie("cooke1 = value; $Path=/; $Domain=.example.com ; Cookie2 = value2; $Path = /foo; $DOMAIN = foo.example.com;");
54     InspectorTest.parseAndDumpCookie("cooke1 = value; $Path=/; $Domain=.example.com\nCookie2 = value2; $Path = /foo; $DOMAIN = foo.example.com; ");
55     InspectorTest.parseAndDumpCookie("$version =1; cooke1 = value; $Path=/; $Domain   =.example.com;  \n Cookie2 = value2; $Path = /foo; $DOMAIN = foo.example.com;");
56
57     InspectorTest.parseAndDumpSetCookie("cookie=value");
58     InspectorTest.parseAndDumpSetCookie("a=b\n c=d\n f");
59     InspectorTest.parseAndDumpSetCookie("cooke1 = value; Path=/; Domain=.example.com;");
60     InspectorTest.parseAndDumpSetCookie("cooke1 = value; Path=/; Domain=  .example.com \nCookie2 = value2; Path = /foo; Domain = foo.example.com");
61     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;");
62     InspectorTest.parseAndDumpSetCookie("cooke1 = value; max-age= 1440; Domain   =.example.com\n Cookie2 = value2; Path = /foo; DOMAIN = foo.example.com; HttpOnly; Secure; Discard;");
63     InspectorTest.completeTest();
64 }
65
66 </script>
67 </head>
68 <body onload="runTest()">
69 <p>Tests inspector cookie parser</p>
70 </body>
71 </html>