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

Side by Side Diff: LayoutTests/http/tests/serviceworker/chromium/resources/clients-openwindow.js

Issue 879403005: [ServiceWorker] Tests for Clients.openWindow(). (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@window_interaction_tests
Patch Set: cleanup and add test helper 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
(Empty)
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.
3 // This helper also exposes |client|, |postMessage()|, |runNextTestOrQuit()|,
4 // |synthesizeNotificationClick()| and |initialize()|.
5 importScripts('sw-test-helpers.js');
6
7 var TESTS = [
8 function testWithNoNotificationClick() {
9 clients.openWindow('/').catch(function(e) {
10 self.postMessage('openWindow() can\'t open a window without a user i nteraction');
11 self.postMessage('openWindow() error is ' + e.name);
12 }).then(runNextTestOrQuit);
13 },
14
15 function testOpenCrossOriginWindow() {
16 synthesizeNotificationClick().then(function(e) {
17 clients.openWindow('https://test.com/').catch(function(e) {
18 self.postMessage('openWindow() can\'t open cross origin windows' );
19 self.postMessage('openWindow() error is ' + e.name);
20 }).then(runNextTestOrQuit);
21 });
22 },
23
24 function testOpenNotControlledWindow() {
25 synthesizeNotificationClick().then(function(e) {
26 clients.openWindow('/').then(function(c) {
27 self.postMessage('openWindow() can open not controlled windows') ;
28 self.postMessage('openWindow() result: ' + c);
29 }).then(runNextTestOrQuit);
30 });
31 },
32
33 function testOpenControlledWindow() {
34 synthesizeNotificationClick().then(function(e) {
35 clients.openWindow('blank.html').then(function(c) {
36 self.postMessage('openWindow() can open controlled windows');
37 self.postMessage('openWindow() result: ' + c);
38 self.postMessage(' url: ' + c.url);
39 self.postMessage(' visibilityState: ' + c.visibilityState);
40 self.postMessage(' focused: ' + c.focused);
41 self.postMessage(' frameType: ' + c.frameType);
42 }).then(runNextTestOrQuit);
43 });
44 }
45 ];
46
47 self.onmessage = function(e) {
48 if (e.data == "start") {
49 initialize().then(runNextTestOrQuit);
50 } else {
51 initialize().then(function() {
52 self.postMessage('received unexpected message');
53 self.postMessage('quit');
54 });
55 }
56 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698