| OLD | NEW |
| (Empty) | |
| 1 <!DOCTYPE html> |
| 2 <title>Service Worker: ServiceWorkerClient.getAll</title> |
| 3 <script src="../resources/testharness.js"></script> |
| 4 <script src="../resources/testharnessreport.js"></script> |
| 5 <script src="resources/test-helpers.js"></script> |
| 6 <script> |
| 7 var scope = 'resources/blank.html?clients-getAll'; |
| 8 var t = async_test('Test ServiceWorkerClient.getAll()'); |
| 9 t.step(function() { |
| 10 service_worker_unregister_and_register( |
| 11 t, 'resources/clients-getall-worker.js', scope) |
| 12 .then(function(registration) { |
| 13 return wait_for_state(t, registration.installing, 'activated'); |
| 14 }) |
| 15 .then(function() { return with_iframe(scope + '#1'); }) |
| 16 .then(function(frame1) { |
| 17 frame1.focus(); |
| 18 return with_iframe(scope + '#2'); |
| 19 }) |
| 20 .then(function(frame2) { |
| 21 var channel = new MessageChannel(); |
| 22 channel.port1.onmessage = t.step_func(onMessage); |
| 23 frame2.contentWindow.navigator.serviceWorker.controller.postMessage( |
| 24 {port:channel.port2}, [channel.port2]); |
| 25 }) |
| 26 .catch(unreached_rejection(t)); |
| 27 }); |
| 28 |
| 29 var expected = [ |
| 30 /* visibilityState, focused, url, frameType */ |
| 31 ['visible', true, new URL(scope + '#1', location).toString(), 'nested'], |
| 32 ['visible', false, new URL(scope + '#2', location).toString(), 'nested'] |
| 33 ]; |
| 34 |
| 35 function onMessage(e) { |
| 36 assert_equals(e.data.length, 2); |
| 37 assert_array_equals(e.data[0], expected[0]); |
| 38 assert_array_equals(e.data[1], expected[1]); |
| 39 service_worker_unregister_and_done(t, scope); |
| 40 } |
| 41 </script> |
| OLD | NEW |