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

Unified Diff: third_party/WebKit/LayoutTests/http/tests/credentialmanager/resources/fetch-serviceworker.html

Issue 1847383003: CREDENTIAL: Rework the integration with Fetch (2/2) Base URL: https://chromium.googlesource.com/chromium/src.git@pass-serialized
Patch Set: unittest Created 4 years, 9 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
Index: third_party/WebKit/LayoutTests/http/tests/credentialmanager/resources/fetch-serviceworker.html
diff --git a/third_party/WebKit/LayoutTests/http/tests/credentialmanager/resources/fetch-serviceworker.html b/third_party/WebKit/LayoutTests/http/tests/credentialmanager/resources/fetch-serviceworker.html
new file mode 100644
index 0000000000000000000000000000000000000000..b3a19d8b6fb1b8b401be366474cf8c14199e4e9f
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/http/tests/credentialmanager/resources/fetch-serviceworker.html
@@ -0,0 +1,36 @@
+<script>
+ var c = new PasswordCredential({
+ id: 'id',
+ password: 'pencil',
+ name: 'name',
+ iconURL: 'https://example.com/icon.png'
+ });
+
+ function testServiceWorkerVisibility() {
+ return new Promise((resolve, reject) => {
+ fetch(window.location.pathname + "?respond-with-body", { credentials: c, method: 'POST' })
+ .then(r => r.json())
+ .then(j => {
+ if (j.credentials != 'password')
+ reject("Credentials was '" + j.credentials + "'");
philipj_slow 2016/04/06 13:33:00 Since you're using fancy new arrow functions, you
+ if (j.body != '')
+ reject("Body was '" + j.body + "'");
+ resolve();
+ });
+ });
+ }
+
+ function testServiceWorkerNetworkVisibility() {
+ return new Promise((resolve, reject) => {
+ fetch("./echo-post.php", { credentials: c, method: "POST" })
+ .then(r => r.json())
+ .then(j => {
+ if (j.username != 'id')
+ reject("Username was '" + j.username + "'");
+ if (j.password != 'pencil')
+ reject("Password was '" + j.password + "'");
+ resolve();
+ });
+ });
+ }
horo 2016/04/04 05:32:17 Please add tests for 1. e.respondWith(fetch(e.requ
+</script>

Powered by Google App Engine
This is Rietveld 408576698