| Index: third_party/WebKit/LayoutTests/http/tests/credentialmanager/passwordcredential-fetch-registrabledomain.html
|
| diff --git a/third_party/WebKit/LayoutTests/http/tests/credentialmanager/passwordcredential-fetch-registrabledomain.html b/third_party/WebKit/LayoutTests/http/tests/credentialmanager/passwordcredential-fetch-registrabledomain.html
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..e720f45ad2484eddbc582ae7a288520168e83240
|
| --- /dev/null
|
| +++ b/third_party/WebKit/LayoutTests/http/tests/credentialmanager/passwordcredential-fetch-registrabledomain.html
|
| @@ -0,0 +1,59 @@
|
| +<!DOCTYPE html>
|
| +<title>Credential Manager: PasswordCredential same-registrable-domain fetching.</title>
|
| +<script src="../resources/testharness.js"></script>
|
| +<script src="../resources/testharnessreport.js"></script>
|
| +<script>
|
| +// Move to a subdomain of `example.test` for testing:
|
| +if (document.location.hostname == "127.0.0.1") {
|
| + document.location.hostname = "subdomain.example.test";
|
| +} else {
|
| + var c = new PasswordCredential({
|
| + id: 'id',
|
| + password: 'pencil',
|
| + name: 'name',
|
| + iconURL: 'https://example.com/icon.png'
|
| + });
|
| +
|
| + promise_test(function() {
|
| + var r1 = new Request('./resources/echo-post.php', { credentials: c, method: "POST" });
|
| + return fetch(r1)
|
| + .then(resp => resp.json())
|
| + .then(j => {
|
| + assert_equals(j.username, 'id');
|
| + assert_equals(j.password, 'pencil');
|
| + });
|
| + }, "Same-origin fetch.");
|
| +
|
| + promise_test(function() {
|
| + var r1 = new Request('http://example.test:8000/credentialmanager/resources/echo-post.php', { credentials: c, method: "POST" });
|
| + return fetch(r1)
|
| + .then(resp => resp.json())
|
| + .then(j => {
|
| + assert_equals(j.username, 'id');
|
| + assert_equals(j.password, 'pencil');
|
| + });
|
| + }, "Fetch from `subdomain.example.test` => `example.test`.");
|
| +
|
| + promise_test(function() {
|
| + var r1 = new Request('http://other.example.test:8000/credentialmanager/resources/echo-post.php', { credentials: c, method: "POST" });
|
| + return fetch(r1)
|
| + .then(resp => resp.json())
|
| + .then(j => {
|
| + assert_equals(j.username, 'id');
|
| + assert_equals(j.password, 'pencil');
|
| + });
|
| + }, "Fetch from `subdomain.example.test` => `other.example.test`.");
|
| +
|
| + promise_test(function() {
|
| + var r1 = new Request('http://other.subdomain.example.test:8000/credentialmanager/resources/echo-post.php', { credentials: c, method: "POST" });
|
| + return fetch(r1)
|
| + .then(resp => resp.json())
|
| + .then(j => {
|
| + assert_equals(j.username, 'id');
|
| + assert_equals(j.password, 'pencil');
|
| + });
|
| + }, "Fetch from `subdomain.example.test` => `other.subdomain.example.test`.");
|
| +}
|
| +</script>
|
| +
|
| +
|
|
|