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

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

Issue 1506783003: ServiceWorker: Reject TypeError instead of SecurityError. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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 importScripts('../../../resources/get-host-info.js'); 6 importScripts('../../../resources/get-host-info.js');
7 7
8 var TESTS = [ 8 var TESTS = [
9 function testWithNoNotificationClick() { 9 function testWithNoNotificationClick() {
10 clients.openWindow('/').catch(function(e) { 10 clients.openWindow('/').catch(function(e) {
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 synthesizeNotificationClick().then(function(e) { 69 synthesizeNotificationClick().then(function(e) {
70 clients.openWindow('http://[test].com').catch(function(error) { 70 clients.openWindow('http://[test].com').catch(function(error) {
71 self.postMessage('openWindow() can not open an invalid url'); 71 self.postMessage('openWindow() can not open an invalid url');
72 self.postMessage('openWindow() error is: ' + error.name); 72 self.postMessage('openWindow() error is: ' + error.name);
73 }).then(runNextTestOrQuit); 73 }).then(runNextTestOrQuit);
74 }); 74 });
75 }, 75 },
76 76
77 function testOpenViewSource() { 77 function testOpenViewSource() {
78 synthesizeNotificationClick().then(function(e) { 78 synthesizeNotificationClick().then(function(e) {
79 clients.openWindow('view-source://http://test.com').catch(function(c ) { 79 clients.openWindow('view-source://http://test.com').catch(function(e rror) {
80 self.postMessage('openWindow() can not open view-source scheme') ; 80 self.postMessage('openWindow() can not open view-source scheme') ;
81 self.postMessage('openWindow() error is: ' + error.name);
81 }).then(runNextTestOrQuit); 82 }).then(runNextTestOrQuit);
82 }); 83 });
83 }, 84 },
84 85
85 function testOpenFileScheme() { 86 function testOpenFileScheme() {
86 synthesizeNotificationClick().then(function(e) { 87 synthesizeNotificationClick().then(function(e) {
87 clients.openWindow('file:///').catch(function(error) { 88 clients.openWindow('file:///').catch(function(error) {
88 self.postMessage('openWindow() can not open file scheme'); 89 self.postMessage('openWindow() can not open file scheme');
89 self.postMessage('openWindow() error is: ' + error.name); 90 self.postMessage('openWindow() error is: ' + error.name);
90 }).then(runNextTestOrQuit); 91 }).then(runNextTestOrQuit);
91 }); 92 });
92 }, 93 },
93 ]; 94 ];
94 95
95 self.onmessage = function(e) { 96 self.onmessage = function(e) {
96 if (e.data == 'start') { 97 if (e.data == 'start') {
97 initialize().then(runNextTestOrQuit); 98 initialize().then(runNextTestOrQuit);
98 } else { 99 } else {
99 initialize().then(function() { 100 initialize().then(function() {
100 self.postMessage('received unexpected message'); 101 self.postMessage('received unexpected message');
101 self.postMessage('quit'); 102 self.postMessage('quit');
102 }); 103 });
103 } 104 }
104 }; 105 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698