Chromium Code Reviews| Index: LayoutTests/http/tests/serviceworker/clients-matchall.html |
| diff --git a/LayoutTests/http/tests/serviceworker/clients-matchall.html b/LayoutTests/http/tests/serviceworker/clients-matchall.html |
| index b76e6482902d04fa7ad00ca38fcd8a808783d556..97060c0db4a17ee8574739a29d7cc03d6e4273f0 100644 |
| --- a/LayoutTests/http/tests/serviceworker/clients-matchall.html |
| +++ b/LayoutTests/http/tests/serviceworker/clients-matchall.html |
| @@ -16,31 +16,50 @@ t.step(function() { |
| .then(function() { return with_iframe(scope + '#1'); }) |
| .then(function(f) { |
| frame1 = f; |
| - f.focus(); |
| return with_iframe(scope + '#2'); |
| }) |
| .then(function(f) { |
| - frame2 = f; |
| - var channel = new MessageChannel(); |
| - channel.port1.onmessage = t.step_func(onMessage); |
| - f.contentWindow.navigator.serviceWorker.controller.postMessage( |
| - {port:channel.port2}, [channel.port2]); |
| + return new Promise(function(resolve) { |
| + frame2 = f; |
| + frame1.focus(); |
| + var channel = new MessageChannel(); |
| + channel.port1.onmessage = t.step_func(resolve); |
| + f.contentWindow.navigator.serviceWorker.controller.postMessage( |
|
nhiroki
2015/08/19 08:01:13
For cleanup, you can retain |registration.installi
jeremyarcher
2015/08/19 08:36:52
Done.
|
| + {port:channel.port2}, [channel.port2]); |
| + }); |
| + }) |
| + .then(function(message) { |
| + return new Promise(function(resolve) { |
| + assert_equals(message.data.length, 2); |
| + assert_array_equals(message.data[0], expectedFirst[0]); |
| + assert_array_equals(message.data[1], expectedFirst[1]); |
| + frame1.focus(); |
|
nhiroki
2015/08/19 08:01:13
This makes the same result with the first trial. f
jeremyarcher
2015/08/19 08:36:52
Oh dear- copy paste strikes again. PTAL
|
| + var channel = new MessageChannel(); |
| + channel.port1.onmessage = t.step_func(resolve); |
| + frame1.contentWindow.navigator.serviceWorker.controller. |
|
nhiroki
2015/08/19 08:01:13
ditto (reg.installing)
jeremyarcher
2015/08/19 08:36:52
Done.
|
| + postMessage({port:channel.port2}, [channel.port2]); |
| + }); |
| + }) |
| + .then(function(message) { |
| + assert_equals(message.data.length, 2); |
| + assert_array_equals(message.data[0], expectedSecond[0]); |
| + assert_array_equals(message.data[1], expectedSecond[1]); |
| + frame1.remove(); |
| + frame2.remove(); |
| + return service_worker_unregister_and_done(t, scope); |
| }) |
| .catch(unreached_rejection(t)); |
| }); |
| -var expected = [ |
| +var expectedFirst = [ |
| /* visibilityState, focused, url, frameType */ |
| ['visible', true, new URL(scope + '#1', location).toString(), 'nested'], |
| ['visible', false, new URL(scope + '#2', location).toString(), 'nested'] |
| ]; |
| -function onMessage(e) { |
| - assert_equals(e.data.length, 2); |
| - assert_array_equals(e.data[0], expected[0]); |
| - assert_array_equals(e.data[1], expected[1]); |
| - frame1.remove(); |
| - frame2.remove(); |
| - service_worker_unregister_and_done(t, scope); |
| -} |
| +var expectedSecond = [ |
| + /* visibilityState, focused, url, frameType */ |
| + ['visible', true, new URL(scope + '#1', location).toString(), 'nested'], |
| + ['visible', false, new URL(scope + '#2', location).toString(), 'nested'] |
| +]; |
| </script> |