Chromium Code Reviews| 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> |