OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <title>Service Worker: Clients.matchAll</title> | 2 <title>Service Worker: Clients.matchAll</title> |
3 <script src="/resources/testharness.js"></script> | 3 <script src="/resources/testharness.js"></script> |
4 <script src="/resources/testharnessreport.js"></script> | 4 <script src="/resources/testharnessreport.js"></script> |
5 <script src="resources/test-helpers.sub.js"></script> | 5 <script src="resources/test-helpers.sub.js"></script> |
6 <script> | 6 <script> |
7 var scope = 'resources/blank.html?clients-matchAll'; | 7 var scope = 'resources/blank.html?clients-matchAll'; |
8 var t = async_test('Test Clients.matchAll()'); | 8 var t = async_test('Test Clients.matchAll()'); |
9 var frames = []; | 9 var frames = []; |
10 t.step(function() { | 10 t.step(function() { |
(...skipping 12 matching lines...) Expand all Loading... |
23 frames.push(frame2); | 23 frames.push(frame2); |
24 var channel = new MessageChannel(); | 24 var channel = new MessageChannel(); |
25 channel.port1.onmessage = t.step_func(onMessage); | 25 channel.port1.onmessage = t.step_func(onMessage); |
26 frame2.contentWindow.navigator.serviceWorker.controller.postMessage( | 26 frame2.contentWindow.navigator.serviceWorker.controller.postMessage( |
27 {port:channel.port2}, [channel.port2]); | 27 {port:channel.port2}, [channel.port2]); |
28 }) | 28 }) |
29 .catch(unreached_rejection(t)); | 29 .catch(unreached_rejection(t)); |
30 }); | 30 }); |
31 | 31 |
32 var expected = [ | 32 var expected = [ |
33 /* visibilityState, focused, url, frameType */ | 33 // visibilityState, focused, url, type, frameType |
34 ['visible', true, new URL(scope + '#1', location).toString(), 'window', 'nes
ted'], | 34 ['visible', true, new URL(scope + '#1', location).toString(), 'window', 'nes
ted'], |
35 ['visible', false, new URL(scope + '#2', location).toString(), 'window', 'ne
sted'] | 35 ['visible', false, new URL(scope + '#2', location).toString(), 'window', 'ne
sted'] |
36 ]; | 36 ]; |
37 | 37 |
38 function onMessage(e) { | 38 function onMessage(e) { |
39 assert_equals(e.data.length, 2); | 39 assert_equals(e.data.length, 2); |
40 assert_array_equals(e.data[0], expected[0]); | 40 assert_array_equals(e.data[0], expected[0]); |
41 assert_array_equals(e.data[1], expected[1]); | 41 assert_array_equals(e.data[1], expected[1]); |
42 frames.forEach(function(f) { f.remove(); }); | 42 frames.forEach(function(f) { f.remove(); }); |
43 service_worker_unregister_and_done(t, scope); | 43 service_worker_unregister_and_done(t, scope); |
44 } | 44 } |
45 </script> | 45 </script> |
OLD | NEW |