Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(8)

Side by Side Diff: LayoutTests/http/tests/serviceworker/clients-matchall.html

Issue 1209493002: Service Worker: Surface Client.id attribute. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Update JS expression for truthiness. Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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.js"></script> 5 <script src="resources/test-helpers.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 frame1, frame2;
9 t.step(function() { 10 t.step(function() {
10 service_worker_unregister_and_register( 11 service_worker_unregister_and_register(
11 t, 'resources/clients-matchall-worker.js', scope) 12 t, 'resources/clients-matchall-worker.js', scope)
12 .then(function(registration) { 13 .then(function(registration) {
13 return wait_for_state(t, registration.installing, 'activated'); 14 return wait_for_state(t, registration.installing, 'activated');
14 }) 15 })
15 .then(function() { return with_iframe(scope + '#1'); }) 16 .then(function() { return with_iframe(scope + '#1'); })
16 .then(function(frame1) { 17 .then(function(f) {
17 frame1.focus(); 18 frame1 = f;
19 f.focus();
18 return with_iframe(scope + '#2'); 20 return with_iframe(scope + '#2');
19 }) 21 })
20 .then(function(frame2) { 22 .then(function(f) {
23 frame2 = f;
21 var channel = new MessageChannel(); 24 var channel = new MessageChannel();
22 channel.port1.onmessage = t.step_func(onMessage); 25 channel.port1.onmessage = t.step_func(onMessage);
23 frame2.contentWindow.navigator.serviceWorker.controller.postMessage( 26 f.contentWindow.navigator.serviceWorker.controller.postMessage(
24 {port:channel.port2}, [channel.port2]); 27 {port:channel.port2}, [channel.port2]);
25 }) 28 })
26 .catch(unreached_rejection(t)); 29 .catch(unreached_rejection(t));
27 }); 30 });
28 31
29 var expected = [ 32 var expected = [
30 /* visibilityState, focused, url, frameType */ 33 /* visibilityState, focused, url, frameType */
31 ['visible', true, new URL(scope + '#1', location).toString(), 'nested'], 34 ['visible', true, new URL(scope + '#1', location).toString(), 'nested'],
32 ['visible', false, new URL(scope + '#2', location).toString(), 'nested'] 35 ['visible', false, new URL(scope + '#2', location).toString(), 'nested']
33 ]; 36 ];
34 37
35 function onMessage(e) { 38 function onMessage(e) {
36 assert_equals(e.data.length, 2); 39 assert_equals(e.data.length, 2);
37 assert_array_equals(e.data[0], expected[0]); 40 assert_array_equals(e.data[0], expected[0]);
38 assert_array_equals(e.data[1], expected[1]); 41 assert_array_equals(e.data[1], expected[1]);
42 frame1.remove();
43 frame2.remove();
39 service_worker_unregister_and_done(t, scope); 44 service_worker_unregister_and_done(t, scope);
40 } 45 }
41 </script> 46 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698