Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 <script> | |
| 2 var c = new PasswordCredential({ | |
| 3 id: 'id', | |
| 4 password: 'pencil', | |
| 5 name: 'name', | |
| 6 iconURL: 'https://example.com/icon.png' | |
| 7 }); | |
| 8 | |
| 9 function testServiceWorkerVisibility() { | |
| 10 return new Promise((resolve, reject) => { | |
| 11 fetch(window.location.pathname + "?respond-with-body", { credentials : c, method: 'POST' }) | |
| 12 .then(r => r.json()) | |
| 13 .then(j => { | |
| 14 if (j.credentials != 'password') | |
| 15 reject("Credentials was '" + j.credentials + "'"); | |
|
philipj_slow
2016/04/06 13:33:00
Since you're using fancy new arrow functions, you
| |
| 16 if (j.body != '') | |
| 17 reject("Body was '" + j.body + "'"); | |
| 18 resolve(); | |
| 19 }); | |
| 20 }); | |
| 21 } | |
| 22 | |
| 23 function testServiceWorkerNetworkVisibility() { | |
| 24 return new Promise((resolve, reject) => { | |
| 25 fetch("./echo-post.php", { credentials: c, method: "POST" }) | |
| 26 .then(r => r.json()) | |
| 27 .then(j => { | |
| 28 if (j.username != 'id') | |
| 29 reject("Username was '" + j.username + "'"); | |
| 30 if (j.password != 'pencil') | |
| 31 reject("Password was '" + j.password + "'"); | |
| 32 resolve(); | |
| 33 }); | |
| 34 }); | |
| 35 } | |
|
horo
2016/04/04 05:32:17
Please add tests for
1. e.respondWith(fetch(e.requ
| |
| 36 </script> | |
| OLD | NEW |