Chromium Code Reviews| Index: third_party/WebKit/LayoutTests/http/tests/credentialmanager/passwordcredential-fetch-serviceworker.html |
| diff --git a/third_party/WebKit/LayoutTests/http/tests/credentialmanager/passwordcredential-fetch-serviceworker.html b/third_party/WebKit/LayoutTests/http/tests/credentialmanager/passwordcredential-fetch-serviceworker.html |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..8f7472f63101b5552d2215299bb790196ac440c4 |
| --- /dev/null |
| +++ b/third_party/WebKit/LayoutTests/http/tests/credentialmanager/passwordcredential-fetch-serviceworker.html |
| @@ -0,0 +1,34 @@ |
| +<!DOCTYPE html> |
| +<title>Credential Manager: PasswordCredential fetch with serviceworker.</title> |
| +<script src="../resources/testharness.js"></script> |
| +<script src="../resources/testharnessreport.js"></script> |
| +<script src="/serviceworker/resources/test-helpers.js"></script> |
| +<script> |
| +function assert_resolves(promise) { |
| + return promise.catch(function(reason) { |
| + throw new Error(reason); |
| + }); |
| +} |
| + |
| +function assert_rejects(promise, description) { |
| + return promise.then( |
| + function(reason) { throw new Error(reason); }, |
| + function() {}); |
| +} |
| + |
| +promise_test(t => { |
| + var scope = "./resources/fetch-serviceworker.html"; |
| + return service_worker_unregister_and_register(t, './resources/respond-with-body.js', scope) |
| + .then(reg => wait_for_state(t, reg.installing, 'activated')) |
| + .then(_ => with_iframe(scope)) |
| + .then(iframe => assert_resolves(iframe.contentWindow.testServiceWorkerVisibility())) |
| + .then(_ => service_worker_unregister_and_done(t, scope)); |
|
horo
2016/04/04 05:32:17
Nit: Remove trailing whitespace.
|
| +}, "Credential not visible to service worker's body."); |
| + |
| +promise_test(t => { |
| + var scope = "./resources/fetch-serviceworker.html"; |
| + return with_iframe(scope) |
|
horo
2016/04/04 05:32:17
You have to register the Service Worker before cal
|
| + .then(iframe => assert_resolves(iframe.contentWindow.testServiceWorkerNetworkVisibility())) |
| + .then(_ => service_worker_unregister_and_done(t, scope)); |
|
horo
2016/04/04 05:32:17
Nit: Remove trailing whitespace.
|
| +}, "Credential visible to network endpoint through service worker."); |
| +</script> |