Commit 115ca244 authored by Mike West's avatar Mike West Committed by Commit Bot

Fixing //cookie/domain WPTs.

The existing //cookie/domain WPTs all use `a` as their cookie name,
which means that they stomp on each other depending on how they're run.
This patch alters the names to distinguish between tests, which should
be more stable.

Change-Id: I2359865246a717cf274be1ab66629b08509498eb
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2127089Reviewed-by: default avatarPhilip Jägenstedt <foolip@chromium.org>
Commit-Queue: Mike West <mkwst@chromium.org>
Cr-Commit-Position: refs/heads/master@{#754882}
parent d76713f6
...@@ -7,18 +7,19 @@ ...@@ -7,18 +7,19 @@
<body> <body>
<script> <script>
// //
// Set-Cookie: a=b; Path=/; Domain=.{{host}} // Set-Cookie: domain-attribute-host-with-and-without-leading-period=b; Path=/; Domain=.{{host}}
// Set-Cookie: a=c; Path=/; Domain={{host}} // Set-Cookie: domain-attribute-host-with-and-without-leading-period=c; Path=/; Domain={{host}}
// //
const cookieName = "domain-attribute-host-with-and-without-leading-period";
test(t => { test(t => {
assert_dom_cookie("a", "c", true); assert_dom_cookie(cookieName, "c", true);
}, "Domain=.{{host}} => Second value available via `document.cookie`"); }, "Domain=.{{host}} => Second value available via `document.cookie`");
async_test(t => { async_test(t => {
fetch("/cookies/resources/list.py", { credentials: "include" }) fetch("/cookies/resources/list.py", { credentials: "include" })
.then(t.step_func(r => r.json())) .then(t.step_func(r => r.json()))
.then(t.step_func_done(r => { .then(t.step_func_done(r => {
assert_equals(r["a"], "c"); assert_equals(r[cookieName], "c");
})) }))
.catch(_ => assert_unreached); .catch(_ => assert_unreached);
}, "Domain=.{{host}} => Second value sent with same-origin requests."); }, "Domain=.{{host}} => Second value sent with same-origin requests.");
...@@ -27,7 +28,7 @@ ...@@ -27,7 +28,7 @@
fetch(`${SECURE_SUBDOMAIN_ORIGIN}/cookies/resources/list.py`, { credentials: "include" }) fetch(`${SECURE_SUBDOMAIN_ORIGIN}/cookies/resources/list.py`, { credentials: "include" })
.then(t.step_func(r => r.json())) .then(t.step_func(r => r.json()))
.then(t.step_func_done(r => { .then(t.step_func_done(r => {
assert_equals(r["a"], "c"); assert_equals(r[cookieName], "c");
})) }))
.catch(_ => assert_unreached); .catch(_ => assert_unreached);
}, "Domain=.{{host}} => Second value sent with subdomain requests."); }, "Domain=.{{host}} => Second value sent with subdomain requests.");
......
Set-Cookie: a=b; Path=/; Domain=.{{host}} Set-Cookie: domain-attribute-host-with-and-without-leading-period=b; Path=/; Domain=.{{host}}
Set-Cookie: a=c; Path=/; Domain={{host}} Set-Cookie: domain-attribute-host-with-and-without-leading-period=c; Path=/; Domain={{host}}
...@@ -7,17 +7,18 @@ ...@@ -7,17 +7,18 @@
<body> <body>
<script> <script>
// //
// Set-Cookie: a=b; Path=/; Domain=.{{host}} // Set-Cookie: domain-attribute-host-with-leading-period=b; Path=/; Domain=.{{host}}
// //
const cookieName = "domain-attribute-host-with-leading-period";
test(t => { test(t => {
assert_dom_cookie("a", "b", true); assert_dom_cookie(cookieName, "b", true);
}, "Domain=.{{host}} => available via `document.cookie`"); }, "Domain=.{{host}} => available via `document.cookie`");
async_test(t => { async_test(t => {
fetch("/cookies/resources/list.py", { credentials: "include" }) fetch("/cookies/resources/list.py", { credentials: "include" })
.then(t.step_func(r => r.json())) .then(t.step_func(r => r.json()))
.then(t.step_func_done(r => { .then(t.step_func_done(r => {
assert_equals(r["a"], "b"); assert_equals(r[cookieName], "b");
})) }))
.catch(_ => assert_unreached); .catch(_ => assert_unreached);
}, "Domain=.{{host}} => sent with same-origin requests."); }, "Domain=.{{host}} => sent with same-origin requests.");
...@@ -26,7 +27,7 @@ ...@@ -26,7 +27,7 @@
fetch(`${SECURE_SUBDOMAIN_ORIGIN}/cookies/resources/list.py`, { credentials: "include" }) fetch(`${SECURE_SUBDOMAIN_ORIGIN}/cookies/resources/list.py`, { credentials: "include" })
.then(t.step_func(r => r.json())) .then(t.step_func(r => r.json()))
.then(t.step_func_done(r => { .then(t.step_func_done(r => {
assert_equals(r["a"], "b"); assert_equals(r[cookieName], "b");
})) }))
.catch(_ => assert_unreached); .catch(_ => assert_unreached);
}, "Domain=.{{host}} => sent with subdomain requests."); }, "Domain=.{{host}} => sent with subdomain requests.");
......
Set-Cookie: a=b; Path=/; Domain=.{{host}} Set-Cookie: domain-attribute-host-with-leading-period=b; Path=/; Domain=.{{host}}
...@@ -7,17 +7,18 @@ ...@@ -7,17 +7,18 @@
<body> <body>
<script> <script>
// //
// Set-Cookie: a=b; Path=/; Domain={{host}} // Set-Cookie: domain-attribute-matches-host=b; Path=/; Domain={{host}}
// //
const cookieName = "domain-attribute-matches-host";
test(t => { test(t => {
assert_dom_cookie("a", "b", true); assert_dom_cookie(cookieName, "b", true);
}, "Domain={{host}} => available via `document.cookie`"); }, "Domain={{host}} => available via `document.cookie`");
async_test(t => { async_test(t => {
fetch("/cookies/resources/list.py", { credentials: "include" }) fetch("/cookies/resources/list.py", { credentials: "include" })
.then(t.step_func(r => r.json())) .then(t.step_func(r => r.json()))
.then(t.step_func_done(r => { .then(t.step_func_done(r => {
assert_equals(r["a"], "b"); assert_equals(r[cookieName], "b");
})) }))
.catch(_ => assert_unreached); .catch(_ => assert_unreached);
}, "Domain={{host}} => sent with same-origin requests."); }, "Domain={{host}} => sent with same-origin requests.");
...@@ -26,7 +27,7 @@ ...@@ -26,7 +27,7 @@
fetch(`${SECURE_SUBDOMAIN_ORIGIN}/cookies/resources/list.py`, { credentials: "include" }) fetch(`${SECURE_SUBDOMAIN_ORIGIN}/cookies/resources/list.py`, { credentials: "include" })
.then(t.step_func(r => r.json())) .then(t.step_func(r => r.json()))
.then(t.step_func_done(r => { .then(t.step_func_done(r => {
assert_equals(r["a"], "b"); assert_equals(r[cookieName], "b");
})) }))
.catch(_ => assert_unreached); .catch(_ => assert_unreached);
}, "Domain={{host}} => sent with subdomain requests."); }, "Domain={{host}} => sent with subdomain requests.");
......
Set-Cookie: a=b; Path=/; Domain={{host}} Set-Cookie: domain-attribute-matches-host=b; Path=/; Domain={{host}}
...@@ -7,17 +7,18 @@ ...@@ -7,17 +7,18 @@
<body> <body>
<script> <script>
// //
// Set-Cookie: a=b; Path=/ // Set-Cookie: domain-attribute-missing=b; Path=/
// //
const cookieName = "domain-attribute-missing";
test(t => { test(t => {
assert_dom_cookie("a", "b", true); assert_dom_cookie(cookieName, "b", true);
}, "No domain attribute => available via `document.cookie`"); }, "No domain attribute => available via `document.cookie`");
async_test(t => { async_test(t => {
fetch("/cookies/resources/list.py", { credentials: "include" }) fetch("/cookies/resources/list.py", { credentials: "include" })
.then(t.step_func(r => r.json())) .then(t.step_func(r => r.json()))
.then(t.step_func_done(r => { .then(t.step_func_done(r => {
assert_equals(r["a"], "b"); assert_equals(r[cookieName], "b");
})) }))
.catch(_ => assert_unreached); .catch(_ => assert_unreached);
}, "No domain attribute => sent with same-origin requests."); }, "No domain attribute => sent with same-origin requests.");
...@@ -26,7 +27,7 @@ ...@@ -26,7 +27,7 @@
fetch(`${SECURE_SUBDOMAIN_ORIGIN}/cookies/resources/list.py`, { credentials: "include" }) fetch(`${SECURE_SUBDOMAIN_ORIGIN}/cookies/resources/list.py`, { credentials: "include" })
.then(t.step_func(r => r.json())) .then(t.step_func(r => r.json()))
.then(t.step_func_done(r => { .then(t.step_func_done(r => {
assert_equals(r["a"], undefined); assert_equals(r[cookieName], undefined);
})) }))
.catch(_ => assert_unreached); .catch(_ => assert_unreached);
}, "No domain attribute => not sent with subdomain requests."); }, "No domain attribute => not sent with subdomain requests.");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment