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

Unified Diff: third_party/WebKit/LayoutTests/external/wpt/service-workers/service-worker/clients-get-client-types.https.html

Issue 2884843004: [ServiceWorker] Add wpt tests to verify Client.type as 'worker' (Closed)
Patch Set: Modify clients-matchall-client-types.https.html Created 3 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/external/wpt/service-workers/service-worker/clients-get-client-types.https-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..39e7328b14dd6e10b33b84dc8f9997b269f3c715 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,19 @@ promise_test(function(t) {
return saw_message;
})
.then(function(e) {
- assert_equals(e.data.length, 2);
+ assert_equals(e.data.length, expected.length);
+ assert_not_equals(e.data[0], undefined,
+ 'Window client should not be undefined');
assert_array_equals(e.data[0], expected[0]);
+ assert_not_equals(e.data[1], undefined,
+ 'Shared worker client should not be undefined');
assert_array_equals(e.data[1], expected[1]);
+ 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]);
+ 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]);
falken 2017/05/26 04:24:58 let's remove the asserts that it's not undefined a
leonhsl(Using Gerrit) 2017/05/26 05:27:32 Done.
});
}, 'Test Clients.get() with window and worker clients');
@@ -64,6 +97,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>
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/external/wpt/service-workers/service-worker/clients-get-client-types.https-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698