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

Side by Side Diff: LayoutTests/http/tests/serviceworker/clients-matchall-include-uncontrolled.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: Restructure tests for readability. 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 with includeUncontrolled</title> 2 <title>Service Worker: Clients.matchAll with includeUncontrolled</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 base_url = 'resources/blank.html'; // This is out-of-scope. 7 var base_url = 'resources/blank.html'; // This is out-of-scope.
8 var scope = base_url + '?clients-matchAll-includeUncontrolled'; 8 var scope = base_url + '?clients-matchAll-includeUncontrolled';
9 9
10 // Creates 3 iframes, 2 for in-scope and 1 for out-of-scope. 10 // Creates 3 iframes, 2 for in-scope and 1 for out-of-scope.
(...skipping 24 matching lines...) Expand all
35 ]; 35 ];
36 36
37 function test_matchall(frame, expected, query_options) { 37 function test_matchall(frame, expected, query_options) {
38 // Make sure we have focus for '#2' frame and its parent window. 38 // Make sure we have focus for '#2' frame and its parent window.
39 frame.focus(); 39 frame.focus();
40 frame.contentWindow.focus(); 40 frame.contentWindow.focus();
41 expected.sort(function(a, b) { return a[2] > b[2] ? 1 : -1; }); 41 expected.sort(function(a, b) { return a[2] > b[2] ? 1 : -1; });
42 return new Promise(function(resolve, reject) { 42 return new Promise(function(resolve, reject) {
43 var channel = new MessageChannel(); 43 var channel = new MessageChannel();
44 channel.port1.onmessage = function(e) { 44 channel.port1.onmessage = function(e) {
45 e.data.sort(function(a, b) { return a[2] > b[2] ? 1 : -1; });
45 assert_equals(e.data.length, expected.length); 46 assert_equals(e.data.length, expected.length);
46 for (var i = 0; i < e.data.length; i++) 47 for (var i = 0; i < e.data.length; i++)
47 assert_array_equals(e.data[i], expected[i]); 48 assert_array_equals(e.data[i], expected[i]);
48 resolve(frame); 49 resolve(frame);
49 }; 50 };
50 frame.contentWindow.navigator.serviceWorker.controller.postMessage( 51 frame.contentWindow.navigator.serviceWorker.controller.postMessage(
51 {port:channel.port2, options:query_options}, 52 {port:channel.port2, options:query_options},
52 [channel.port2]); 53 [channel.port2]);
53 }); 54 });
54 } 55 }
(...skipping 15 matching lines...) Expand all
70 return test_matchall(frame, expected_with_include_uncontrolled, 71 return test_matchall(frame, expected_with_include_uncontrolled,
71 {includeUncontrolled:true}); 72 {includeUncontrolled:true});
72 }) 73 })
73 .then(function() { 74 .then(function() {
74 service_worker_unregister_and_done(t, scope); 75 service_worker_unregister_and_done(t, scope);
75 }) 76 })
76 .catch(unreached_rejection(t)); 77 .catch(unreached_rejection(t));
77 }, 'Verify matchAll() respect includeUncontrolled'); 78 }, 'Verify matchAll() respect includeUncontrolled');
78 79
79 </script> 80 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698