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

Side by Side Diff: LayoutTests/http/tests/serviceworker/registration.html

Issue 697833004: ServiceWorker: Registering a malformed script should fail [3/3] (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@install_malformed_script
Patch Set: add more tests Created 6 years, 1 month 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
« no previous file with comments | « no previous file | LayoutTests/http/tests/serviceworker/resources/malformed-worker.php » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <title>Service Worker: Registration</title> 2 <title>Service Worker: Registration</title>
3 <script src="../resources/testharness.js"></script> 3 <script src="../resources/testharness.js"></script>
4 <script src="../resources/testharness-helpers.js"></script> 4 <script src="../resources/testharness-helpers.js"></script>
5 <script src="../resources/testharnessreport.js"></script> 5 <script src="../resources/testharnessreport.js"></script>
6 <script src="resources/test-helpers.js"></script> 6 <script src="resources/test-helpers.js"></script>
7 <script> 7 <script>
8 8
9 promise_test(function(t) { 9 promise_test(function(t) {
10 var script = 'resources/registration-worker.js'; 10 var script = 'resources/registration-worker.js';
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 var scope = 'resources/scope/plain-text-worker/'; 114 var scope = 'resources/scope/plain-text-worker/';
115 return assert_promise_rejects( 115 return assert_promise_rejects(
116 navigator.serviceWorker.register(script, {scope: scope}), 116 navigator.serviceWorker.register(script, {scope: scope}),
117 'SecurityError', 117 'SecurityError',
118 'Registration of plain text script should fail.'); 118 'Registration of plain text script should fail.');
119 }, 'Registering script without correct MIME type'); 119 }, 'Registering script without correct MIME type');
120 120
121 promise_test(function(t) { 121 promise_test(function(t) {
122 var script = 'resources/redirect.php?Redirect=' + 122 var script = 'resources/redirect.php?Redirect=' +
123 encodeURIComponent('/resources/registration-worker.js'); 123 encodeURIComponent('/resources/registration-worker.js');
124 var scope = 'resources/sope/redirect/'; 124 var scope = 'resources/scope/redirect/';
125 return assert_promise_rejects( 125 return assert_promise_rejects(
126 navigator.serviceWorker.register(script, {scope: scope}), 126 navigator.serviceWorker.register(script, {scope: scope}),
127 'SecurityError', 127 'SecurityError',
128 'Registration of redirected script should fail.'); 128 'Registration of redirected script should fail.');
129 }, 'Registering redirected script'); 129 }, 'Registering redirected script');
130 130
131 promise_test(function(t) {
132 var script = 'resources/malformed-worker.php?parse-error';
133 var scope = 'resources/scope/parse-error';
134 return assert_promise_rejects(
135 navigator.serviceWorker.register(script, {scope: scope}),
136 'AbortError',
137 'Registration of script including parse error should fail.');
138 }, 'Registering script including parse error');
139
140 promise_test(function(t) {
141 var script = 'resources/malformed-worker.php?undefined-error';
142 var scope = 'resources/scope/undefined-error';
143 return assert_promise_rejects(
144 navigator.serviceWorker.register(script, {scope: scope}),
145 'AbortError',
146 'Registration of script including undefined error should fail.');
147 }, 'Registering script including undefined error');
148
149 promise_test(function(t) {
150 var script = 'resources/malformed-worker.php?uncaught-exception';
151 var scope = 'resources/scope/uncaught-exception';
152 return assert_promise_rejects(
153 navigator.serviceWorker.register(script, {scope: scope}),
154 'AbortError',
155 'Registration of script including uncaught exception should fail.');
156 }, 'Registering script including uncaught exception');
157
158 promise_test(function(t) {
159 var script = 'resources/malformed-worker.php?caught-exception';
160 var scope = 'resources/scope/caught-exception';
161 return navigator.serviceWorker.register(script, {scope: scope})
162 .then(function(registration) {
163 assert_true(registration instanceof ServiceWorkerRegistration,
164 'Successfully registered.');
165 service_worker_unregister_and_done(t, scope);
166 })
167 }, 'Registering script including caught exception');
168
169 promise_test(function(t) {
170 var script = 'resources/malformed-worker.php?import-malformed-script';
171 var scope = 'resources/scope/import-malformed-script';
172 return assert_promise_rejects(
173 navigator.serviceWorker.register(script, {scope: scope}),
174 'AbortError',
175 'Registration of script importing malformed script should fail.');
176 }, 'Registering script importing malformed script');
177
178 promise_test(function(t) {
179 var script = 'resources/malformed-worker.php?import-no-such-script';
180 var scope = 'resources/scope/import-no-such-script';
181 return assert_promise_rejects(
182 navigator.serviceWorker.register(script, {scope: scope}),
183 'AbortError',
184 'Registration of script importing non-existent script should fail.');
185 }, 'Registering script importing non-existent script');
186
131 </script> 187 </script>
OLDNEW
« no previous file with comments | « no previous file | LayoutTests/http/tests/serviceworker/resources/malformed-worker.php » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698