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

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

Issue 1209933003: ServiceWorkerClients::openWindow() should reject with TypeError for an invalid URL. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 5 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 sequentially 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 clients.openWindow('/').catch(function(e) { 9 clients.openWindow('/').catch(function(e) {
10 self.postMessage('openWindow() can\'t open a window without a user i nteraction'); 10 self.postMessage('openWindow() can\'t open a window without a user i nteraction');
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 54
55 function testOpenAboutCrash() { 55 function testOpenAboutCrash() {
56 synthesizeNotificationClick().then(function(e) { 56 synthesizeNotificationClick().then(function(e) {
57 clients.openWindow('about:crash').then(function(c) { 57 clients.openWindow('about:crash').then(function(c) {
58 self.postMessage('openWindow() can open about:crash'); 58 self.postMessage('openWindow() can open about:crash');
59 self.postMessage('openWindow() result: ' + c); 59 self.postMessage('openWindow() result: ' + c);
60 }).then(runNextTestOrQuit); 60 }).then(runNextTestOrQuit);
61 }); 61 });
62 }, 62 },
63 63
64 function testOpenInvalidURL() {
65 synthesizeNotificationClick().then(function(e) {
66 clients.openWindow('http://[test].com').catch(function(error) {
67 self.postMessage('openWindow() can not open an invalid url');
68 self.postMessage('openWindow() error is: ' + error.name);
69 }).then(runNextTestOrQuit);
70 });
71 },
72
64 function testOpenViewSource() { 73 function testOpenViewSource() {
65 synthesizeNotificationClick().then(function(e) { 74 synthesizeNotificationClick().then(function(e) {
66 clients.openWindow('view-source://http://test.com').catch(function(c ) { 75 clients.openWindow('view-source://http://test.com').catch(function(c ) {
67 self.postMessage('openWindow() can not open view-source scheme') ; 76 self.postMessage('openWindow() can not open view-source scheme') ;
68 }).then(runNextTestOrQuit); 77 }).then(runNextTestOrQuit);
69 }); 78 });
70 }, 79 },
71 80
72 function testOpenFileScheme() { 81 function testOpenFileScheme() {
73 synthesizeNotificationClick().then(function(e) { 82 synthesizeNotificationClick().then(function(e) {
74 clients.openWindow('file:///').catch(function(error) { 83 clients.openWindow('file:///').catch(function(error) {
75 self.postMessage('openWindow() can not open file scheme'); 84 self.postMessage('openWindow() can not open file scheme');
76 self.postMessage('openWindow() error is: ' + error.name); 85 self.postMessage('openWindow() error is: ' + error.name);
77 }).then(runNextTestOrQuit); 86 }).then(runNextTestOrQuit);
78 }); 87 });
79 }, 88 },
80 ]; 89 ];
81 90
82 self.onmessage = function(e) { 91 self.onmessage = function(e) {
83 if (e.data == 'start') { 92 if (e.data == 'start') {
84 initialize().then(runNextTestOrQuit); 93 initialize().then(runNextTestOrQuit);
85 } else { 94 } else {
86 initialize().then(function() { 95 initialize().then(function() {
87 self.postMessage('received unexpected message'); 96 self.postMessage('received unexpected message');
88 self.postMessage('quit'); 97 self.postMessage('quit');
89 }); 98 });
90 } 99 }
91 }; 100 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698