| Index: third_party/WebKit/LayoutTests/external/wpt/service-workers/service-worker/clients-get-client-types.https.html
|
| diff --git a/third_party/WebKit/LayoutTests/external/wpt/service-workers/service-worker/clients-get-client-types.https.html b/third_party/WebKit/LayoutTests/external/wpt/service-workers/service-worker/clients-get-client-types.https.html
|
| index 5bb312844af978c86b6fd3581eafa0de7ece5e32..897e3689ed34f1f2abafffb6e4a6e47408bd1f03 100644
|
| --- a/third_party/WebKit/LayoutTests/external/wpt/service-workers/service-worker/clients-get-client-types.https.html
|
| +++ b/third_party/WebKit/LayoutTests/external/wpt/service-workers/service-worker/clients-get-client-types.https.html
|
| @@ -7,6 +7,7 @@
|
| var scope = 'resources/clients-get-client-types';
|
| var frame_url = scope + '-frame.html';
|
| var shared_worker_url = scope + '-shared-worker.js';
|
| +var worker_url = scope + '-worker.js';
|
| var client_ids = [];
|
| var frame;
|
| promise_test(function(t) {
|
| @@ -37,6 +38,28 @@ promise_test(function(t) {
|
| .then(function(client_id) {
|
| client_ids.push(client_id);
|
| var channel = new MessageChannel();
|
| + var w = new Worker(worker_url);
|
| + w.postMessage({cmd:'GetClientId', port:channel.port2},
|
| + [channel.port2]);
|
| + return new Promise(function(resolve) {
|
| + channel.port1.onmessage = function(e) {
|
| + resolve(e.data.clientId);
|
| + };
|
| + });
|
| + })
|
| + .then(function(client_id) {
|
| + client_ids.push(client_id);
|
| + var channel = new MessageChannel();
|
| + frame.contentWindow.postMessage('StartWorker', '*', [channel.port2]);
|
| + return new Promise(function(resolve) {
|
| + channel.port1.onmessage = function(e) {
|
| + resolve(e.data.clientId);
|
| + };
|
| + });
|
| + })
|
| + .then(function(client_id) {
|
| + client_ids.push(client_id);
|
| + var channel = new MessageChannel();
|
| var saw_message = new Promise(function(resolve) {
|
| channel.port1.onmessage = resolve;
|
| });
|
| @@ -45,9 +68,23 @@ promise_test(function(t) {
|
| return saw_message;
|
| })
|
| .then(function(e) {
|
| - assert_equals(e.data.length, 2);
|
| - assert_array_equals(e.data[0], expected[0]);
|
| - assert_array_equals(e.data[1], expected[1]);
|
| + assert_equals(e.data.length, expected.length);
|
| + // We use these assert_not_equals because assert_array_equals doesn't
|
| + // print the error description when passed an undefined value.
|
| + assert_not_equals(e.data[0], undefined,
|
| + 'Window client should not be undefined');
|
| + assert_array_equals(e.data[0], expected[0], 'Window client');
|
| + assert_not_equals(e.data[1], undefined,
|
| + 'Shared worker client should not be undefined');
|
| + assert_array_equals(e.data[1], expected[1], 'Shared worker client');
|
| + assert_not_equals(e.data[2], undefined,
|
| + 'Worker(Started by main frame) client should not be undefined');
|
| + assert_array_equals(e.data[2], expected[2],
|
| + 'Worker(Started by main frame) client');
|
| + assert_not_equals(e.data[3], undefined,
|
| + 'Worker(Started by sub frame) client should not be undefined');
|
| + assert_array_equals(e.data[3], expected[3],
|
| + 'Worker(Started by sub frame) client');
|
| });
|
| }, 'Test Clients.get() with window and worker clients');
|
|
|
| @@ -64,6 +101,8 @@ function wait_for_clientId() {
|
| var expected = [
|
| // visibilityState, focused, url, type, frameType
|
| ['visible', true, normalizeURL(scope) + '-frame.html', 'window', 'nested'],
|
| - [undefined, undefined, normalizeURL(scope) + '-shared-worker.js', 'sharedworker', 'none']
|
| + [undefined, undefined, normalizeURL(scope) + '-shared-worker.js', 'sharedworker', 'none'],
|
| + [undefined, undefined, normalizeURL(scope) + '-worker.js', 'worker', 'none'],
|
| + [undefined, undefined, normalizeURL(scope) + '-frame-worker.js', 'worker', 'none']
|
| ];
|
| </script>
|
|
|