summaryrefslogtreecommitdiffstats
path: root/LayoutTests/http/tests/cookies/script-tests
diff options
context:
space:
mode:
Diffstat (limited to 'LayoutTests/http/tests/cookies/script-tests')
-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
5 files changed, 70 insertions, 0 deletions
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;