Chromium Code Reviews| Index: LayoutTests/http/tests/serviceworker/install-event-type.html |
| diff --git a/LayoutTests/http/tests/serviceworker/install-event-type.html b/LayoutTests/http/tests/serviceworker/install-event-type.html |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..dabe49a2b4f360bb7bf906ab7ff140598be3a12b |
| --- /dev/null |
| +++ b/LayoutTests/http/tests/serviceworker/install-event-type.html |
| @@ -0,0 +1,29 @@ |
| +<!DOCTYPE html> |
| +<script src="../resources/testharness.js"></script> |
| +<script src="../resources/testharness-helpers.js"></script> |
| +<script src="../resources/testharnessreport.js"></script> |
| +<script src="resources/test-helpers.js"></script> |
| +<script> |
| +function wait_for_install_event(worker) { |
| + return new Promise(function(resolve) { |
| + worker.addEventListener('statechange', function(event) { |
| + if (worker.state == 'installed') |
| + resolve(true); |
| + else if (worker.state == 'redundant') |
| + resolve(false); |
| + }); |
| + }); |
| +} |
| + |
| +promise_test(function(t) { |
| + return service_worker_unregister_and_register(t, 'resources/oninstall-event-type.js', 'resources/oninstall-event-type.js') |
|
falken
2015/04/08 05:44:46
By convention, service worker script filenames end
Paritosh Kumar
2015/04/08 06:44:06
Thanks. Done.
OO, I was using 'resources/oninstal
|
| + .then(function(registration) { |
| + return wait_for_install_event(registration.installing); |
| + }) |
| + .then(function(did_install) { |
| + assert_equals(did_install, true,'The worker was installed'); |
|
falken
2015/04/08 05:44:46
You can use assert_true rather than assert_equals
Paritosh Kumar
2015/04/08 06:44:06
Yeah.. Thanks.
|
| + }) |
| + }, 'install event type'); |
| + |
| +</script> |
| + |
|
falken
2015/04/08 05:44:46
nit: extra empty line
Paritosh Kumar
2015/04/08 06:44:06
Done.
|