Chromium Code Reviews| Index: LayoutTests/http/tests/serviceworker/waiting.html |
| diff --git a/LayoutTests/http/tests/serviceworker/waiting.html b/LayoutTests/http/tests/serviceworker/waiting.html |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..89bc149684cd58a3b5e49001af77886df91c311f |
| --- /dev/null |
| +++ b/LayoutTests/http/tests/serviceworker/waiting.html |
| @@ -0,0 +1,45 @@ |
| +<!DOCTYPE html> |
| +<title>ServiceWorker: navigator.serviceWorker.waiting</title> |
| +<script src="../resources/testharness.js"></script> |
| +<script src="../resources/testharnessreport.js"></script> |
| +<script src="resources/test-helpers.js"></script> |
| +<body> |
| +<script> |
| +var t = async_test('waiting is set'); |
| +t.step(function() { |
| + var url = 'resources/worker-no-op.js'; |
| + var scope = 'resources/blank.html'; |
| + var frame; |
| + |
| + navigator.serviceWorker.unregister(scope) |
| + .then(function() { return with_iframe(scope); }, |
|
jsbell
2014/06/10 17:59:32
Style nit: In other tests, we don't seem to start
jsbell
2014/06/10 17:59:33
Needs t.step_func() wrapper (testharness.js is upd
dominicc (has gone to gerrit)
2014/06/10 21:27:18
Yeah, I wrote it the style guide way, and then dec
jsbell
2014/06/10 22:36:23
Sounds good. It's not my personal preference for n
|
| + unreached_rejection(t, 'Unregister should not fail')) |
| + .then(function(f) { |
|
jsbell
2014/06/10 17:59:32
Needs t.step_func() wrapper
dominicc (has gone to gerrit)
2014/06/10 21:27:18
The only thing that does for me is fail the test i
jsbell
2014/06/10 22:36:23
Correct. However, from my experience trying to deb
|
| + frame = f; |
| + return navigator.serviceWorker.register(url, {scope: scope}); |
| + }) |
| + .then(function(serviceWorker) { |
|
jsbell
2014/06/10 17:59:32
Needs t.step_func() wrapper
|
| + // FIXME: Replace this with .ready when that supports the in-waiting |
| + // Service Worker. |
| + return new Promise(function(resolve, reject) { |
|
jsbell
2014/06/10 17:59:32
Needs t.step_func() wrapper
|
| + serviceWorker.onstatechange = function() { |
|
jsbell
2014/06/10 17:59:32
Needs t.step_func() wrapper
|
| + if (serviceWorker.state == 'installed') { |
| + resolve(); |
| + } |
| + }; |
| + }); |
| + }, unreached_rejection(t, 'Registration should not fail')) |
| + .then(t.step_func(function() { |
| + var container = frame.contentWindow.navigator.serviceWorker; |
| + assert_equals(container.controller, null); |
| + assert_equals(container.waiting.url, normalizeURL(url)); |
| + |
| + // FIXME: Add a test for a frame created after installation. |
| + // Should the existing frame ("frame") block activation? |
| + })) |
| + .then(function() { |
|
jsbell
2014/06/10 17:59:32
Needs t.step_func() wrapper
|
| + frame.remove(); |
| + return service_worker_unregister_and_done(t, scope); |
| + }); |
| +}); |
| +</script> |