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

Side by Side Diff: LayoutTests/http/tests/serviceworker/chromium/resources/notificationclick-can-focus.js

Issue 866043005: [ServiceWorker] Tests for WindowClient.focus(). (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@sw_openwindow_tests
Patch Set: review comment Created 5 years, 10 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 // This helper will setup a small test framework that will use TESTS and run 1 // This helper will setup a small test framework that will use TESTS and run
2 // them iteratively and call self.postMessage('quit') when done. 2 // them sequentially and call self.postMessage('quit') when done.
3 // This helper also exposes |client|, |postMessage()|, |runNextTestOrQuit()|, 3 // This helper also exposes |client|, |postMessage()|, |runNextTestOrQuit()|,
4 // |synthesizeNotificationClick()| and |initialize()|. 4 // |synthesizeNotificationClick()| and |initialize()|.
5 importScripts('sw-test-helpers.js'); 5 importScripts('sw-test-helpers.js');
6 6
7 var TESTS = [ 7 var TESTS = [
8 function testWithNoNotificationClick() { 8 function testWithNoNotificationClick() {
9 client.focus().catch(function() { 9 client.focus().catch(function() {
10 self.postMessage('focus() outside of a notificationclick event faile d'); 10 self.postMessage('focus() outside of a notificationclick event faile d');
11 }).then(runNextTestOrQuit); 11 }).then(runNextTestOrQuit);
12 }, 12 },
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 e.waitUntil(clients.openWindow('/foo.html').then(function() { 72 e.waitUntil(clients.openWindow('/foo.html').then(function() {
73 client.focus().catch(function() { 73 client.focus().catch(function() {
74 self.postMessage('focus() failed because a window was opened before'); 74 self.postMessage('focus() failed because a window was opened before');
75 }).then(runNextTestOrQuit); 75 }).then(runNextTestOrQuit);
76 })); 76 }));
77 }); 77 });
78 }, 78 },
79 ]; 79 ];
80 80
81 self.onmessage = function(e) { 81 self.onmessage = function(e) {
82 if (e.data == "start") { 82 if (e.data == 'start') {
83 initialize().then(runNextTestOrQuit); 83 initialize().then(runNextTestOrQuit);
84 } else { 84 } else {
85 initialize().then(function() { 85 initialize().then(function() {
86 self.postMessage('received unexpected message'); 86 self.postMessage('received unexpected message');
87 self.postMessage('quit'); 87 self.postMessage('quit');
88 }); 88 });
89 } 89 }
90 } 90 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698