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

Side by Side Diff: third_party/WebKit/LayoutTests/imported/wpt/service-workers/service-worker/clients-matchall-client-types.https.html

Issue 2415873002: Import w3c tests for the service workers (Closed)
Patch Set: Rebase Created 4 years, 2 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 various clientTypes</title> 2 <title>Service Worker: Clients.matchAll with various clientTypes</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.sub.js"></script>
6 <script> 6 <script>
7 var scope = 'resources/clients-matchall-client-types'; 7 var scope = 'resources/clients-matchall-client-types';
8 var iframe_url = scope + '-iframe.html'; 8 var iframe_url = scope + '-iframe.html';
9 var shared_worker_url = scope + '-shared-worker.js'; 9 var shared_worker_url = scope + '-shared-worker.js';
10 10
11 /* visibilityState, focused, url, frameType */ 11 /* visibilityState, focused, url, frameType */
12 var expected_without_type = [ 12 var expected_without_type = [
13 ['visible', true, new URL(iframe_url, location).href, 'nested'] 13 ['visible', true, new URL(iframe_url, location).href, 'nested']
14 ]; 14 ];
15 var expected_with_window = [ 15 var expected_with_window = [
16 ['visible', true, new URL(iframe_url, location).href, 'nested'] 16 ['visible', true, new URL(iframe_url, location).href, 'nested']
17 ]; 17 ];
18 var expected_with_shared_worker = [ 18 var expected_with_shared_worker = [
19 [,,new URL(shared_worker_url, location).href, 'none'] 19 [,,new URL(shared_worker_url, location).href, 'none']
20 ]; 20 ];
21 var expected_with_all = [ 21 var expected_with_all = [
22 ['visible', true, new URL(iframe_url, location).href, 'nested'], 22 ['visible', true, new URL(iframe_url, location).href, 'nested'],
23 [,,new URL(shared_worker_url, location).href, 'none'] 23 [,,new URL(shared_worker_url, location).href, 'none']
24 ]; 24 ];
25 25
26 function test_matchall(frame, expected, query_options) { 26 function test_matchall(frame, expected, query_options) {
27 // Make sure the frame gets focus. 27 // Make sure the frame gets focus.
28 frame.focus(); 28 frame.focus();
29 expected.sort(function(a, b) { return a[2] > b[2] ? 1 : -1; });
29 return new Promise(function(resolve, reject) { 30 return new Promise(function(resolve, reject) {
30 var channel = new MessageChannel(); 31 var channel = new MessageChannel();
31 channel.port1.onmessage = function(e) { 32 channel.port1.onmessage = function(e) {
32 assert_equals(e.data.length, expected.length); 33 assert_equals(e.data.length, expected.length);
33 for (var i = 0; i < e.data.length; i++) 34 for (var i = 0; i < e.data.length; i++)
34 assert_array_equals(e.data[i], expected[i]); 35 assert_array_equals(e.data[i], expected[i]);
35 resolve(); 36 resolve();
36 }; 37 };
37 frame.contentWindow.navigator.serviceWorker.controller.postMessage( 38 frame.contentWindow.navigator.serviceWorker.controller.postMessage(
38 {port:channel.port2, options:query_options}, 39 {port:channel.port2, options:query_options},
(...skipping 15 matching lines...) Expand all
54 var w = new SharedWorker(shared_worker_url); 55 var w = new SharedWorker(shared_worker_url);
55 w.port.onmessage = resolve; 56 w.port.onmessage = resolve;
56 }); 57 });
57 }) 58 })
58 .then(function() { 59 .then(function() {
59 return test_matchall(frame, expected_without_type, {}); 60 return test_matchall(frame, expected_without_type, {});
60 }) 61 })
61 .then(function() { 62 .then(function() {
62 return test_matchall(frame, expected_with_window, {type:'window'}); 63 return test_matchall(frame, expected_with_window, {type:'window'});
63 }) 64 })
64 .then(function() { 65 //.then(function() {
65 return test_matchall(frame, expected_with_shared_worker, 66 // return test_matchall(frame, expected_with_shared_worker,
66 {type:'sharedworker'}); 67 // {type:'sharedworker'});
67 }) 68 // })
68 .then(function() { 69 //.then(function() {
69 return test_matchall(frame, expected_with_all, {type:'all'}); 70 // return test_matchall(frame, expected_with_all, {type:'all'});
70 }) 71 // })
71 .then(function() { 72 .then(function() {
72 frame.remove(); 73 frame.remove();
73 return service_worker_unregister_and_done(t, scope); 74 return service_worker_unregister_and_done(t, scope);
74 }); 75 });
75 }, 'Verify matchAll() with various client types'); 76 }, 'Verify matchAll() with various client types');
76 77
77 </script> 78 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698