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

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

Issue 1286123004: Ensure that Service Worker clients are always returned in MRU order (2) (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 4 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 var frame1, frame2;
10
10 t.step(function() { 11 t.step(function() {
11 service_worker_unregister_and_register( 12 service_worker_unregister_and_register(
12 t, 'resources/clients-matchall-worker.js', scope) 13 t, 'resources/clients-matchall-worker.js', scope)
13 .then(function(registration) { 14 .then(function(registration) {
14 return wait_for_state(t, registration.installing, 'activated'); 15 return wait_for_state(t, registration.installing, 'activated');
15 }) 16 })
16 .then(function() { return with_iframe(scope + '#1'); }) 17 .then(function() { return with_popup(scope + '#1'); })
nhiroki 2015/08/17 06:58:45 Why don't you use iframe? (iframe is a window-clie
falken 2015/08/17 07:10:19 I too would prefer iframe if possible. Otherwise w
17 .then(function(f) { 18 .then(function(f) {
18 frame1 = f; 19 frame1 = f;
19 f.focus(); 20 f.focus();
20 return with_iframe(scope + '#2'); 21 return with_popup(scope + '#2');
21 }) 22 })
22 .then(function(f) { 23 .then(function(f) {
23 frame2 = f; 24 frame2 = f;
24 var channel = new MessageChannel(); 25 var channel = new MessageChannel();
25 channel.port1.onmessage = t.step_func(onMessage); 26 channel.port1.onmessage = t.step_func(
26 f.contentWindow.navigator.serviceWorker.controller.postMessage( 27 onMessage.bind(null, pageOrder));
27 {port:channel.port2}, [channel.port2]); 28 frame1.navigator.serviceWorker.controller.postMessage(
29 {port:channel.port2, retainOriginalOrder:true}, [channel.port2]);
28 }) 30 })
29 .catch(unreached_rejection(t)); 31 .catch(unreached_rejection(t));
30 }); 32 });
31 33
32 var expected = [ 34 var pageOrder = [
falken 2015/08/17 07:10:19 our wpt tests use snake_case for variables and fun
33 /* visibilityState, focused, url, frameType */ 35 new URL(scope + '#2', location).toString(),
34 ['visible', true, new URL(scope + '#1', location).toString(), 'nested'], 36 new URL(scope + '#1', location).toString()
falken 2015/08/17 07:10:19 This test can be more discerning, now if the impl
35 ['visible', false, new URL(scope + '#2', location).toString(), 'nested'] 37 ]
nhiroki 2015/08/17 06:58:45 nit: ';'
36 ];
37 38
38 function onMessage(e) { 39 function onMessage(expected, e) {
39 assert_equals(e.data.length, 2); 40 var urls = [];
40 assert_array_equals(e.data[0], expected[0]); 41 for (var i = 0; i < e.data.length; i++)
41 assert_array_equals(e.data[1], expected[1]); 42 urls[i] = e.data[i][2];
42 frame1.remove(); 43 assert_array_equals(urls, expected);
43 frame2.remove(); 44 frame1.close();
45 frame2.close();
44 service_worker_unregister_and_done(t, scope); 46 service_worker_unregister_and_done(t, scope);
45 } 47 }
46 </script> 48 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698