summaryrefslogtreecommitdiffstats
path: root/LayoutTests
diff options
context:
space:
mode:
authorSteve Block <steveblock@google.com>2010-11-24 13:46:35 +0000
committerSteve Block <steveblock@google.com>2010-11-24 14:56:39 +0000
commit63796d97248956b9c06a7889b007b34bc8b486f4 (patch)
tree27ce93ae24d8d9b672c617fc5e02896f00a73a1c /LayoutTests
parent0c918ae77b5edfe59b726ff40a7c86dbc4a94307 (diff)
downloadexternal_webkit-63796d97248956b9c06a7889b007b34bc8b486f4.zip
external_webkit-63796d97248956b9c06a7889b007b34bc8b486f4.tar.gz
external_webkit-63796d97248956b9c06a7889b007b34bc8b486f4.tar.bz2
Add LayoutTests http/tests/cookies at r71558
All tests pass or have failing test expectations. Bug: 3227269 Change-Id: Ia0d58eb29d312c57c2f687e5431bb997b9433560
Diffstat (limited to 'LayoutTests')
-rw-r--r--LayoutTests/http/tests/cookies/double-quoted-value-with-semi-colon-expected.txt11
-rw-r--r--LayoutTests/http/tests/cookies/double-quoted-value-with-semi-colon.html13
-rw-r--r--LayoutTests/http/tests/cookies/multiple-cookies-expected.txt13
-rw-r--r--LayoutTests/http/tests/cookies/multiple-cookies.html13
-rwxr-xr-xLayoutTests/http/tests/cookies/resources/clearCookies.cgi27
-rw-r--r--LayoutTests/http/tests/cookies/resources/cookie-utility.php40
-rw-r--r--LayoutTests/http/tests/cookies/resources/cookies-test-post.js5
-rw-r--r--LayoutTests/http/tests/cookies/resources/cookies-test-pre.js239
-rw-r--r--LayoutTests/http/tests/cookies/resources/cookies-test-style.css12
-rwxr-xr-xLayoutTests/http/tests/cookies/resources/getCookies.cgi8
-rw-r--r--LayoutTests/http/tests/cookies/resources/resetCookies.js18
-rwxr-xr-xLayoutTests/http/tests/cookies/resources/setCookies.cgi9
-rw-r--r--LayoutTests/http/tests/cookies/resources/third-party-cookie-relaxing-iframe.html59
-rw-r--r--LayoutTests/http/tests/cookies/script-tests/TEMPLATE.html13
-rw-r--r--LayoutTests/http/tests/cookies/script-tests/double-quoted-value-with-semi-colon.js11
-rw-r--r--LayoutTests/http/tests/cookies/script-tests/multiple-cookies.js13
-rw-r--r--LayoutTests/http/tests/cookies/script-tests/simple-cookies-expired.js18
-rw-r--r--LayoutTests/http/tests/cookies/script-tests/simple-cookies-max-age.js15
-rw-r--r--LayoutTests/http/tests/cookies/simple-cookies-expired-expected.txt13
-rw-r--r--LayoutTests/http/tests/cookies/simple-cookies-expired.html13
-rw-r--r--LayoutTests/http/tests/cookies/simple-cookies-max-age-expected.txt13
-rw-r--r--LayoutTests/http/tests/cookies/simple-cookies-max-age.html13
-rw-r--r--LayoutTests/http/tests/cookies/third-party-cookie-relaxing-expected.txt47
-rw-r--r--LayoutTests/http/tests/cookies/third-party-cookie-relaxing.html96
-rwxr-xr-xLayoutTests/platform/android/layout_test_directories.txt1
-rw-r--r--LayoutTests/platform/android/test_expectations.txt1
26 files changed, 734 insertions, 0 deletions
diff --git a/LayoutTests/http/tests/cookies/double-quoted-value-with-semi-colon-expected.txt b/LayoutTests/http/tests/cookies/double-quoted-value-with-semi-colon-expected.txt
new file mode 100644
index 0000000..e3bf3f6
--- /dev/null
+++ b/LayoutTests/http/tests/cookies/double-quoted-value-with-semi-colon-expected.txt
@@ -0,0 +1,11 @@
+Test for <rdar://problem/5666078> Cookie parsing terminates at the first semicolon, ignoring quotes (16699)
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+Check that setting a cookie with a semi-colon in a duoble-quoted value works
+PASS cookie is 'disorder="477beccb;richard"'.
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/http/tests/cookies/double-quoted-value-with-semi-colon.html b/LayoutTests/http/tests/cookies/double-quoted-value-with-semi-colon.html
new file mode 100644
index 0000000..0b06db7
--- /dev/null
+++ b/LayoutTests/http/tests/cookies/double-quoted-value-with-semi-colon.html
@@ -0,0 +1,13 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<link rel="stylesheet" href="resources/cookies-test-style.css">
+<script src="resources/cookies-test-pre.js"></script>
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+<script src="script-tests/double-quoted-value-with-semi-colon.js"></script>
+<script src="resources/cookies-test-post.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/http/tests/cookies/multiple-cookies-expected.txt b/LayoutTests/http/tests/cookies/multiple-cookies-expected.txt
new file mode 100644
index 0000000..35b58c1
--- /dev/null
+++ b/LayoutTests/http/tests/cookies/multiple-cookies-expected.txt
@@ -0,0 +1,13 @@
+This test checks that mulitple cookies are correctly set.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+Check setting several cookies without clearing.
+PASS cookie is 'test=foobar'.
+PASS cookie is 'test2=foobar; test=foobar'.
+PASS cookie is 'test2=foobar; test3=foobar; test=foobar'.
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/http/tests/cookies/multiple-cookies.html b/LayoutTests/http/tests/cookies/multiple-cookies.html
new file mode 100644
index 0000000..e5b14f3
--- /dev/null
+++ b/LayoutTests/http/tests/cookies/multiple-cookies.html
@@ -0,0 +1,13 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<link rel="stylesheet" href="resources/cookies-test-style.css">
+<script src="resources/cookies-test-pre.js"></script>
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+<script src="script-tests/multiple-cookies.js"></script>
+<script src="resources/cookies-test-post.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/http/tests/cookies/resources/clearCookies.cgi b/LayoutTests/http/tests/cookies/resources/clearCookies.cgi
new file mode 100755
index 0000000..27896b7
--- /dev/null
+++ b/LayoutTests/http/tests/cookies/resources/clearCookies.cgi
@@ -0,0 +1,27 @@
+#!/usr/bin/perl -wT
+use strict;
+
+print "Content-Type: text/plain\n";
+print "Cache-Control: no-store\n";
+print 'Cache-Control: no-cache="set-cookie"' . "\n";
+
+my $cookie = $ENV{"HTTP_CLEAR_COOKIE"};
+
+if ($cookie =~ /Max-Age/i) {
+ $cookie =~ s/Max-Age *= *[0-9]+/Max-Age=0/i;
+} else {
+ $cookie .= ";" unless ($cookie =~ m/;$/);
+ $cookie .= " " unless ($cookie =~ m/ $/);
+ $cookie .= "Max-Age=0";
+}
+
+if ($cookie =~ /Expires/i) {
+ # Set the "Expires" field to UNIX epoch
+ $cookie =~ s/Expires *= *[^;]+/Expires=Thu, 01 Jan 1970 00:00:00 GMT/i;
+} else {
+ $cookie .= ";" unless ($cookie =~ m/;$/);
+ $cookie .= " " unless ($cookie =~ m/ $/);
+ $cookie .= "Expires=Thu, 01 Jan 1970 00:00:00 GMT";
+}
+
+print "Set-Cookie: $cookie\n\n";
diff --git a/LayoutTests/http/tests/cookies/resources/cookie-utility.php b/LayoutTests/http/tests/cookies/resources/cookie-utility.php
new file mode 100644
index 0000000..a33e7ac
--- /dev/null
+++ b/LayoutTests/http/tests/cookies/resources/cookie-utility.php
@@ -0,0 +1,40 @@
+<?php
+parse_str($_SERVER["QUERY_STRING"]);
+
+function deleteCookie($value, $name)
+{
+ setcookie($name, "deleted", time() - 86400, '/');
+}
+
+if ($queryfunction == "deleteCookies") {
+ array_walk($_COOKIE, deleteCookie);
+ echo "Deleted all cookies";
+ return;
+}
+
+if ($queryfunction == "setFooCookie") {
+ setcookie("foo", "awesomevalue", time() + 86400, '/');
+ echo "Set the foo cookie";
+ return;
+}
+
+if ($queryfunction == "setFooAndBarCookie") {
+ setcookie("foo", "awesomevalue", time() + 86400, '/');
+ setcookie("bar", "anotherawesomevalue", time() + 86400, '/');
+ echo "Set the foo and bar cookies";
+ return;
+}
+
+// Default for any other string is echo cookies.
+function echoCookie($value, $name)
+{
+ echo "$name = $value\n";
+}
+
+function echoAllCookies()
+{
+ echo "Cookies are:\n";
+ array_walk($_COOKIE, echoCookie);
+}
+
+?>
diff --git a/LayoutTests/http/tests/cookies/resources/cookies-test-post.js b/LayoutTests/http/tests/cookies/resources/cookies-test-post.js
new file mode 100644
index 0000000..6970120
--- /dev/null
+++ b/LayoutTests/http/tests/cookies/resources/cookies-test-post.js
@@ -0,0 +1,5 @@
+shouldBeTrue("successfullyParsed");
+debug('<br /><span class="pass">TEST COMPLETE</span>');
+
+// Make sure that we do not leak any cookies.
+clearCookies();
diff --git a/LayoutTests/http/tests/cookies/resources/cookies-test-pre.js b/LayoutTests/http/tests/cookies/resources/cookies-test-pre.js
new file mode 100644
index 0000000..80b0ff1
--- /dev/null
+++ b/LayoutTests/http/tests/cookies/resources/cookies-test-pre.js
@@ -0,0 +1,239 @@
+if (window.layoutTestController)
+ layoutTestController.dumpAsText();
+
+function description(msg)
+{
+ // For MSIE 6 compatibility
+ var span = document.createElement("span");
+ span.innerHTML = '<p>' + msg + '</p><p>On success, you will see a series of "<span class="pass">PASS</span>" messages, followed by "<span class="pass">TEST COMPLETE</span>".</p>';
+ var description = document.getElementById("description");
+ if (description.firstChild)
+ description.replaceChild(span, description.firstChild);
+ else
+ description.appendChild(span);
+}
+
+function debug(msg)
+{
+ var span = document.createElement("span");
+ document.getElementById("console").appendChild(span); // insert it first so XHTML knows the namespace
+ span.innerHTML = msg + '<br />';
+}
+
+function escapeHTML(text)
+{
+ return text.replace(/&/g, "&amp;").replace(/</g, "&lt;");
+}
+
+function testPassed(msg)
+{
+ debug('<span><span class="pass">PASS</span> ' + escapeHTML(msg) + '</span>');
+}
+
+function testFailed(msg)
+{
+ debug('<span><span class="fail">FAIL</span> ' + escapeHTML(msg) + '</span>');
+}
+
+function areArraysEqual(_a, _b)
+{
+ if (_a.length !== _b.length)
+ return false;
+ for (var i = 0; i < _a.length; i++)
+ if (_a[i] !== _b[i])
+ return false;
+ return true;
+}
+
+function isMinusZero(n)
+{
+ // the only way to tell 0 from -0 in JS is the fact that 1/-0 is
+ // -Infinity instead of Infinity
+ return n === 0 && 1/n < 0;
+}
+
+function isResultCorrect(_actual, _expected)
+{
+ if (_expected === 0)
+ return _actual === _expected && (1/_actual) === (1/_expected);
+ if (_actual === _expected)
+ return true;
+ if (typeof(_expected) == "number" && isNaN(_expected))
+ return typeof(_actual) == "number" && isNaN(_actual);
+ if (Object.prototype.toString.call(_expected) == Object.prototype.toString.call([]))
+ return areArraysEqual(_actual, _expected);
+ return false;
+}
+
+function stringify(v)
+{
+ if (v === 0 && 1/v < 0)
+ return "-0";
+ else return "" + v;
+}
+
+function shouldBe(_a, _b)
+{
+ if (typeof _a != "string" || typeof _b != "string")
+ debug("WARN: shouldBe() expects string arguments");
+ var exception;
+ var _av;
+ try {
+ _av = eval(_a);
+ } catch (e) {
+ exception = e;
+ }
+ var _bv = eval(_b);
+
+ if (exception)
+ testFailed(_a + " should be " + _bv + ". Threw exception " + exception);
+ else if (isResultCorrect(_av, _bv))
+ testPassed(_a + " is " + _b);
+ else if (typeof(_av) == typeof(_bv))
+ testFailed(_a + " should be " + _bv + ". Was " + stringify(_av) + ".");
+ else
+ testFailed(_a + " should be " + _bv + " (of type " + typeof _bv + "). Was " + _av + " (of type " + typeof _av + ").");
+}
+
+function shouldBeTrue(_a) { shouldBe(_a, "true"); }
+function shouldBeFalse(_a) { shouldBe(_a, "false"); }
+function shouldBeNaN(_a) { shouldBe(_a, "NaN"); }
+function shouldBeNull(_a) { shouldBe(_a, "null"); }
+
+function shouldBeEqualToString(a, b)
+{
+ var unevaledString = '"' + b.replace(/"/g, "\"") + '"';
+ shouldBe(a, unevaledString);
+}
+
+function shouldBeUndefined(_a)
+{
+ var exception;
+ var _av;
+ try {
+ _av = eval(_a);
+ } catch (e) {
+ exception = e;
+ }
+
+ if (exception)
+ testFailed(_a + " should be undefined. Threw exception " + exception);
+ else if (typeof _av == "undefined")
+ testPassed(_a + " is undefined.");
+ else
+ testFailed(_a + " should be undefined. Was " + _av);
+}
+
+function shouldThrow(_a, _e)
+{
+ var exception;
+ var _av;
+ try {
+ _av = eval(_a);
+ } catch (e) {
+ exception = e;
+ }
+
+ var _ev;
+ if (_e)
+ _ev = eval(_e);
+
+ if (exception) {
+ if (typeof _e == "undefined" || exception == _ev)
+ testPassed(_a + " threw exception " + exception + ".");
+ else
+ testFailed(_a + " should throw " + (typeof _e == "undefined" ? "an exception" : _ev) + ". Threw exception " + exception + ".");
+ } else if (typeof _av == "undefined")
+ testFailed(_a + " should throw " + (typeof _e == "undefined" ? "an exception" : _ev) + ". Was undefined.");
+ else
+ testFailed(_a + " should throw " + (typeof _e == "undefined" ? "an exception" : _ev) + ". Was " + _av + ".");
+}
+
+var cookies = new Array();
+
+// This method sets the cookies using XMLHttpRequest.
+// We do not set the cookie right away as it is forbidden by the XHR spec.
+// FIXME: Add the possibility to set multiple cookies in a row.
+function setCookies(cookie)
+{
+ try {
+ var xhr = new XMLHttpRequest();
+ xhr.open("GET", "resources/setCookies.cgi", false);
+ xhr.setRequestHeader("SET_COOKIE", cookie);
+ xhr.send(null);
+ if (xhr.status == 200) {
+ // This is to clear them later.
+ cookies.push(cookie);
+ return true;
+ } else
+ return false;
+ } catch (e) {
+ return false;
+ }
+}
+
+// Normalize a cookie string
+function normalizeCookie(cookie)
+{
+ // Split the cookie string, sort it and then put it back together.
+ return cookie.split('; ').sort().join('; ');
+}
+
+// We get the cookies throught an XMLHttpRequest.
+function testCookies(result)
+{
+ var xhr = new XMLHttpRequest();
+ xhr.open("GET", "resources/getCookies.cgi", false);
+ xhr.send(null);
+ var cookie = xhr.getResponseHeader("HTTP_COOKIE") == null ? '"null"' : xhr.getResponseHeader("HTTP_COOKIE");
+
+ // Normalize the cookie strings.
+ result = normalizeCookie(result);
+ cookie = normalizeCookie(cookie);
+
+ if (cookie === result)
+ testPassed("cookie is '" + cookie + "'.");
+ else
+ testFailed("cookie was '" + cookie + "'. Expected '" + result + "'.");
+}
+
+function clearAllCookies()
+{
+ var cookieString;
+ while (cookieString = document.cookie) {
+ var cookieName = cookieString.substr(0, cookieString.indexOf("=") || cookieString.length());
+ cookies.push(cookieName);
+ clearCookies();
+ }
+}
+
+function clearCookies()
+{
+ if (!cookies.length)
+ return;
+
+ try {
+ var xhr = new XMLHttpRequest();
+ var cookie;
+ // We need to clean one cookie at a time because to be cleared the
+ // cookie must be exactly the same except for the "Max-Age"
+ // and "Expires" fields.
+ while (cookie = cookies.pop()) {
+ xhr.open("GET", "resources/clearCookies.cgi", false);
+ xhr.setRequestHeader("CLEAR_COOKIE", cookie);
+ xhr.send(null);
+ }
+ } catch (e) {
+ debug("Could not clear the cookies expect the following results to fail");
+ }
+}
+
+// This method check one cookie at a time.
+function cookiesShouldBe(cookiesToSet, result)
+{
+ if (!setCookies(cookiesToSet)) {
+ testFailed("could not set cookie(s) " + cookiesToSet);
+ return;
+ }
+ testCookies(result);
+}
diff --git a/LayoutTests/http/tests/cookies/resources/cookies-test-style.css b/LayoutTests/http/tests/cookies/resources/cookies-test-style.css
new file mode 100644
index 0000000..f12147c
--- /dev/null
+++ b/LayoutTests/http/tests/cookies/resources/cookies-test-style.css
@@ -0,0 +1,12 @@
+.pass {
+ font-weight: bold;
+ color: green;
+}
+.fail {
+ font-weight: bold;
+ color: red;
+}
+#console {
+ white-space: pre-wrap;
+ font-family: monospace;
+}
diff --git a/LayoutTests/http/tests/cookies/resources/getCookies.cgi b/LayoutTests/http/tests/cookies/resources/getCookies.cgi
new file mode 100755
index 0000000..c4377c3
--- /dev/null
+++ b/LayoutTests/http/tests/cookies/resources/getCookies.cgi
@@ -0,0 +1,8 @@
+#!/usr/bin/perl -wT
+use strict;
+
+print "Content-Type: text/plain\n";
+print "Cache-Control: no-store\n";
+print 'Cache-Control: no-cache="set-cookie"' . "\n";
+
+print "HTTP_COOKIE: " . ($ENV{HTTP_COOKIE} || "") . "\n\n";
diff --git a/LayoutTests/http/tests/cookies/resources/resetCookies.js b/LayoutTests/http/tests/cookies/resources/resetCookies.js
new file mode 100644
index 0000000..577822a
--- /dev/null
+++ b/LayoutTests/http/tests/cookies/resources/resetCookies.js
@@ -0,0 +1,18 @@
+function resetCookies()
+{
+ if (window.layoutTestController)
+ layoutTestController.setAlwaysAcceptCookies(true);
+
+ // Due to cross-origin restrictions, we can only (simply) reset cookies for our current origin.
+ var url = "http://" + window.location.hostname +":8000/cookies/resources/cookie-utility.php?queryfunction=deleteCookies";
+ var req = new XMLHttpRequest();
+ try {
+ req.open('GET', url, false);
+ req.send();
+ } catch (e) {
+ alert("Attempt to clear " + url + " cookies might have failed. Test results might be off from here on out. (" + e + ")");
+ }
+
+ if (window.layoutTestController)
+ layoutTestController.setAlwaysAcceptCookies(false);
+}
diff --git a/LayoutTests/http/tests/cookies/resources/setCookies.cgi b/LayoutTests/http/tests/cookies/resources/setCookies.cgi
new file mode 100755
index 0000000..b9c4b21
--- /dev/null
+++ b/LayoutTests/http/tests/cookies/resources/setCookies.cgi
@@ -0,0 +1,9 @@
+#!/usr/bin/perl -wT
+use strict;
+
+print "Content-Type: text/plain\n";
+print "Cache-Control: no-store\n";
+print 'Cache-Control: no-cache="set-cookie"' . "\n";
+
+# We only map the SET_COOKIE request header to "Set-Cookie"
+print "Set-Cookie: " . $ENV{"HTTP_SET_COOKIE"} . "\n\n";
diff --git a/LayoutTests/http/tests/cookies/resources/third-party-cookie-relaxing-iframe.html b/LayoutTests/http/tests/cookies/resources/third-party-cookie-relaxing-iframe.html
new file mode 100644
index 0000000..d16964e
--- /dev/null
+++ b/LayoutTests/http/tests/cookies/resources/third-party-cookie-relaxing-iframe.html
@@ -0,0 +1,59 @@
+<html>
+<script src="resetCookies.js"></script>
+<script>
+resetCookies();
+
+if (window.layoutTestController)
+ layoutTestController.dumpAsText();
+
+window.onmessage = function(evt)
+{
+ if (evt.data == "showCookies") {
+ showCookies();
+ return;
+ } else if (evt.data.split(" ")[0] == "sendXHR") {
+ sendXHR(evt.data.split(" ")[1]);
+ return;
+ } else if (evt.data == "resetCookiesAndNotifyDone") {
+ resetCookiesAndNotifyDone();
+ return;
+ } else
+ alert("Unknown message.");
+}
+
+var stage = 1;
+function showCookies()
+{
+ alert("Test stage " + stage++ + " document.cookie is: " + document.cookie);
+ parent.window.postMessage("done", "*");
+}
+
+function sendXHR(queryCommand)
+{
+ var baseurl = "http://localhost:8000/cookies/resources/cookie-utility.php";
+ var url = queryCommand ? baseurl + "?queryfunction=" + queryCommand : baseurl;
+ alert(url);
+ var req = new XMLHttpRequest();
+ req.open('GET', url, false);
+ req.send();
+
+ if (req.status == 200)
+ alert("XHR response - " + req.responseText);
+ else
+ alert("xhr error");
+
+ parent.window.postMessage("done", "*");
+}
+
+function resetCookiesAndNotifyDone()
+{
+ resetCookies();
+ if (window.layoutTestController)
+ layoutTestController.notifyDone();
+}
+
+</script>
+<body>
+HELLO THERE
+</body>
+</html>
diff --git a/LayoutTests/http/tests/cookies/script-tests/TEMPLATE.html b/LayoutTests/http/tests/cookies/script-tests/TEMPLATE.html
new file mode 100644
index 0000000..6483f50
--- /dev/null
+++ b/LayoutTests/http/tests/cookies/script-tests/TEMPLATE.html
@@ -0,0 +1,13 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<link rel="stylesheet" href="resources/cookies-test-style.css">
+<script src="resources/cookies-test-pre.js"></script>
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+<script src="YOUR_JS_FILE_HERE"></script>
+<script src="resources/cookies-test-post.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/http/tests/cookies/script-tests/double-quoted-value-with-semi-colon.js b/LayoutTests/http/tests/cookies/script-tests/double-quoted-value-with-semi-colon.js
new file mode 100644
index 0000000..9029875
--- /dev/null
+++ b/LayoutTests/http/tests/cookies/script-tests/double-quoted-value-with-semi-colon.js
@@ -0,0 +1,11 @@
+description(
+'Test for &lt;<a href="rdar://problem/5666078">rdar://problem/5666078</a>&gt; Cookie parsing terminates at the first semicolon, ignoring quotes (<a href="https://bugs.webkit.org/show_bug.cgi?id=16699">16699</a>)'
+);
+
+clearAllCookies();
+
+debug("Check that setting a cookie with a semi-colon in a duoble-quoted value works");
+cookiesShouldBe('disorder="477beccb;richard";Version=1;Path=/', 'disorder="477beccb;richard"');
+clearCookies();
+
+successfullyParsed = true;
diff --git a/LayoutTests/http/tests/cookies/script-tests/multiple-cookies.js b/LayoutTests/http/tests/cookies/script-tests/multiple-cookies.js
new file mode 100644
index 0000000..618e224
--- /dev/null
+++ b/LayoutTests/http/tests/cookies/script-tests/multiple-cookies.js
@@ -0,0 +1,13 @@
+description(
+"This test checks that mulitple cookies are correctly set."
+);
+
+clearAllCookies();
+
+debug("Check setting several cookies without clearing.");
+cookiesShouldBe("test=foobar;", "test=foobar");
+cookiesShouldBe("test2=foobar;", "test=foobar; test2=foobar");
+cookiesShouldBe("test3=foobar;", "test=foobar; test2=foobar; test3=foobar");
+clearCookies();
+
+successfullyParsed = true;
diff --git a/LayoutTests/http/tests/cookies/script-tests/simple-cookies-expired.js b/LayoutTests/http/tests/cookies/script-tests/simple-cookies-expired.js
new file mode 100644
index 0000000..61b70fb
--- /dev/null
+++ b/LayoutTests/http/tests/cookies/script-tests/simple-cookies-expired.js
@@ -0,0 +1,18 @@
+description(
+"This test checks that cookies are correctly set using Expires."
+);
+
+clearAllCookies();
+
+debug("Check that setting a simple cookie works.");
+var date = new Date();
+date.setTime(date.getTime() + 60 * 1000);
+cookiesShouldBe("test=foobar; Expires=" + date.toGMTString(), "test=foobar");
+clearCookies();
+
+debug("Check setting a cookie that timed out.");
+date.setTime(date.getTime() - 2 * 60 * 1000);
+cookiesShouldBe("test2=foobar; Expires=" + date.toGMTString(), "");
+clearCookies();
+
+successfullyParsed = true;
diff --git a/LayoutTests/http/tests/cookies/script-tests/simple-cookies-max-age.js b/LayoutTests/http/tests/cookies/script-tests/simple-cookies-max-age.js
new file mode 100644
index 0000000..1d87b13
--- /dev/null
+++ b/LayoutTests/http/tests/cookies/script-tests/simple-cookies-max-age.js
@@ -0,0 +1,15 @@
+description(
+"This test checks that cookies are correctly set using Max-Age."
+);
+
+clearAllCookies();
+
+debug("Check that setting a simple cookie works.");
+cookiesShouldBe("test=foobar; Max-Age=90000000", "test=foobar");
+clearCookies();
+
+debug("Check setting a cookie that timed out.");
+cookiesShouldBe("test2=foobar; Max-Age=0", "");
+clearCookies();
+
+successfullyParsed = true;
diff --git a/LayoutTests/http/tests/cookies/simple-cookies-expired-expected.txt b/LayoutTests/http/tests/cookies/simple-cookies-expired-expected.txt
new file mode 100644
index 0000000..d0a5c55
--- /dev/null
+++ b/LayoutTests/http/tests/cookies/simple-cookies-expired-expected.txt
@@ -0,0 +1,13 @@
+This test checks that cookies are correctly set using Expires.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+Check that setting a simple cookie works.
+PASS cookie is 'test=foobar'.
+Check setting a cookie that timed out.
+PASS cookie is ''.
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/http/tests/cookies/simple-cookies-expired.html b/LayoutTests/http/tests/cookies/simple-cookies-expired.html
new file mode 100644
index 0000000..6015d0d
--- /dev/null
+++ b/LayoutTests/http/tests/cookies/simple-cookies-expired.html
@@ -0,0 +1,13 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<link rel="stylesheet" href="resources/cookies-test-style.css">
+<script src="resources/cookies-test-pre.js"></script>
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+<script src="script-tests/simple-cookies-expired.js"></script>
+<script src="resources/cookies-test-post.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/http/tests/cookies/simple-cookies-max-age-expected.txt b/LayoutTests/http/tests/cookies/simple-cookies-max-age-expected.txt
new file mode 100644
index 0000000..859c392
--- /dev/null
+++ b/LayoutTests/http/tests/cookies/simple-cookies-max-age-expected.txt
@@ -0,0 +1,13 @@
+This test checks that cookies are correctly set using Max-Age.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+Check that setting a simple cookie works.
+PASS cookie is 'test=foobar'.
+Check setting a cookie that timed out.
+PASS cookie is ''.
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/http/tests/cookies/simple-cookies-max-age.html b/LayoutTests/http/tests/cookies/simple-cookies-max-age.html
new file mode 100644
index 0000000..23eee96
--- /dev/null
+++ b/LayoutTests/http/tests/cookies/simple-cookies-max-age.html
@@ -0,0 +1,13 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<link rel="stylesheet" href="resources/cookies-test-style.css">
+<script src="resources/cookies-test-pre.js"></script>
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+<script src="script-tests/simple-cookies-max-age.js"></script>
+<script src="resources/cookies-test-post.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/http/tests/cookies/third-party-cookie-relaxing-expected.txt b/LayoutTests/http/tests/cookies/third-party-cookie-relaxing-expected.txt
new file mode 100644
index 0000000..184a97a
--- /dev/null
+++ b/LayoutTests/http/tests/cookies/third-party-cookie-relaxing-expected.txt
@@ -0,0 +1,47 @@
+ALERT:
+
+ALERT: Allowing all cookies
+ALERT: http://localhost:8000/cookies/resources/cookie-utility.php?queryfunction=deleteCookies
+ALERT: XHR response - Deleted all cookies
+ALERT: Test stage 1 document.cookie is:
+ALERT: Restricting to first party only cookies
+ALERT: http://localhost:8000/cookies/resources/cookie-utility.php?queryfunction=setFooCookie
+ALERT: XHR response - Set the foo cookie
+ALERT: Test stage 2 document.cookie is:
+ALERT:
+
+ALERT: Allowing all cookies
+ALERT: http://localhost:8000/cookies/resources/cookie-utility.php?queryfunction=deleteCookies
+ALERT: XHR response - Deleted all cookies
+ALERT: Test stage 3 document.cookie is:
+ALERT: Restricting to first party only cookies
+ALERT: http://localhost:8000/cookies/resources/cookie-utility.php?queryfunction=setFooAndBarCookie
+ALERT: XHR response - Set the foo and bar cookies
+ALERT: Test stage 4 document.cookie is:
+ALERT:
+
+ALERT: Allowing all cookies
+ALERT: http://localhost:8000/cookies/resources/cookie-utility.php?queryfunction=deleteCookies
+ALERT: XHR response - Deleted all cookies
+ALERT: Test stage 5 document.cookie is:
+ALERT: http://localhost:8000/cookies/resources/cookie-utility.php?queryfunction=setFooCookie
+ALERT: XHR response - Set the foo cookie
+ALERT: Test stage 6 document.cookie is: foo=awesomevalue
+ALERT: Restricting to first party only cookies
+ALERT: http://localhost:8000/cookies/resources/cookie-utility.php?queryfunction=deleteCookies
+ALERT: XHR response - Deleted all cookies
+ALERT: Test stage 7 document.cookie is:
+ALERT:
+
+ALERT: Allowing all cookies
+ALERT: http://localhost:8000/cookies/resources/cookie-utility.php?queryfunction=deleteCookies
+ALERT: XHR response - Deleted all cookies
+ALERT: Test stage 8 document.cookie is:
+ALERT: http://localhost:8000/cookies/resources/cookie-utility.php?queryfunction=setFooCookie
+ALERT: XHR response - Set the foo cookie
+ALERT: Test stage 9 document.cookie is: foo=awesomevalue
+ALERT: Restricting to first party only cookies
+ALERT: http://localhost:8000/cookies/resources/cookie-utility.php?queryfunction=setFooAndBarCookie
+ALERT: XHR response - Set the foo and bar cookies
+ALERT: Test stage 10 document.cookie is: bar=anotherawesomevalue; foo=awesomevalue
+
diff --git a/LayoutTests/http/tests/cookies/third-party-cookie-relaxing.html b/LayoutTests/http/tests/cookies/third-party-cookie-relaxing.html
new file mode 100644
index 0000000..df9c4b9
--- /dev/null
+++ b/LayoutTests/http/tests/cookies/third-party-cookie-relaxing.html
@@ -0,0 +1,96 @@
+<html>
+<head>
+<script src="resources/resetCookies.js"></script>
+<script>
+resetCookies();
+
+if (window.layoutTestController) {
+ layoutTestController.dumpAsText();
+ layoutTestController.waitUntilDone();
+}
+
+window.onmessage = function(evt)
+{
+ if (evt.data != "done") {
+ alert("Unexpected message: " + evt.data);
+ return;
+ }
+
+ runNextTestOrFinish();
+}
+
+function allowAllCookies()
+{
+ alert("Allowing all cookies");
+ if (window.layoutTestController)
+ layoutTestController.setAlwaysAcceptCookies(true);
+ runNextTestOrFinish();
+}
+
+function restrictCookies()
+{
+ alert("Restricting to first party only cookies");
+ if (window.layoutTestController)
+ layoutTestController.setAlwaysAcceptCookies(false);
+ runNextTestOrFinish();
+}
+
+function deleteAllCookies()
+{
+ sendXHR("deleteCookies");
+}
+
+function echoCookies()
+{
+ window.frames[0].postMessage("showCookies", "*");
+}
+
+function sendXHR(command)
+{
+ window.frames[0].postMessage("sendXHR " + command, "*");
+}
+
+function setFooCookie()
+{
+ sendXHR("setFooCookie");
+}
+
+function setFooAndBarCookies()
+{
+ sendXHR("setFooAndBarCookie");
+}
+
+function startNewTest()
+{
+ alert("\n");
+ runNextTestOrFinish();
+}
+
+var currentFunction = 0;
+var functions = new Array(
+ startNewTest, allowAllCookies, deleteAllCookies, echoCookies, restrictCookies, setFooCookie, echoCookies,
+ startNewTest, allowAllCookies, deleteAllCookies, echoCookies, restrictCookies, setFooAndBarCookies, echoCookies,
+ startNewTest, allowAllCookies, deleteAllCookies, echoCookies, setFooCookie, echoCookies, restrictCookies, deleteAllCookies, echoCookies,
+ startNewTest, allowAllCookies, deleteAllCookies, echoCookies, setFooCookie, echoCookies, restrictCookies, setFooAndBarCookies, echoCookies
+);
+
+function runNextTestOrFinish()
+{
+ if (currentFunction >= functions.length) {
+ if (window.layoutTestController) {
+ resetCookies();
+ window.frames[0].postMessage("resetCookiesAndNotifyDone", "*");
+ }
+ return;
+ }
+
+ var functionToRun = currentFunction++;
+ functions[functionToRun]();
+}
+
+</script>
+</head>
+<body onload="runNextTestOrFinish();">
+<iframe id='testFrame' src="http://localhost:8000/cookies/resources/third-party-cookie-relaxing-iframe.html"></iframe>
+</body>
+</html>
diff --git a/LayoutTests/platform/android/layout_test_directories.txt b/LayoutTests/platform/android/layout_test_directories.txt
index da81ffd..703c4da 100755
--- a/LayoutTests/platform/android/layout_test_directories.txt
+++ b/LayoutTests/platform/android/layout_test_directories.txt
@@ -36,6 +36,7 @@ fast/url
fast/xpath
http/conf
http/tests/appcache
+http/tests/cookies
http/tests/resources
http/tests/ssl
platform/android
diff --git a/LayoutTests/platform/android/test_expectations.txt b/LayoutTests/platform/android/test_expectations.txt
index 375a595..d0a039c 100644
--- a/LayoutTests/platform/android/test_expectations.txt
+++ b/LayoutTests/platform/android/test_expectations.txt
@@ -66,6 +66,7 @@ fast/events/touch/basic-multi-touch-events.html FAIL // Requires multi-touch ges
fast/events/touch/touch-coords-in-zoom-and-scroll.html FAIL // Requires eventSender.zoomPageIn(),zoomPageOut()
fast/events/touch/touch-target.html FAIL // Requires multi-touch gestures not supported by Android system
fast/workers FAIL // workers not supported
+http/tests/cookies/third-party-cookie-relaxing.html FAIL // We don't support conditional acceptance of third-party cookies
http/tests/eventsource/workers FAIL // workers not supported
http/tests/workers FAIL // workers not supported
http/tests/xmlhttprequest/workers FAIL // workers not supported