Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(20)

Unified Diff: third_party/WebKit/LayoutTests/http/tests/credentialmanager/passwordcredential-fetch-registrabledomain.html

Issue 1918253002: CREDENTIAL: Credentials should be submitted within a registrable domain. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: vabr@ Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/http/tests/credentialmanager/resources/echo-post.php » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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>
+
+
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/http/tests/credentialmanager/resources/echo-post.php » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698