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

Side by Side Diff: third_party/WebKit/LayoutTests/external/wpt/service-workers/service-worker/resources/import-scripts-updated-flag-worker.js

Issue 2864783002: Upstream service wrkr `importScripts` tests to WPT (Closed)
Patch Set: Incorporate review feedback Created 3 years, 7 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 importScripts('../../resources/testharness.js'); 1 importScripts('/resources/testharness.js');
2 2
3 let echo_output = null; 3 let echo_output = null;
4 4
5 // Tests importing a script that sets |echo_output| to the query string. 5 // Tests importing a script that sets |echo_output| to the query string.
6 function test_import(str) { 6 function test_import(str) {
7 importScripts('echo.php?' + str); 7 importScripts('import-scripts-echo.py?msg=' + str);
8 assert_equals(echo_output, str); 8 assert_equals(echo_output, str);
9 } 9 }
10 10
11 test_import('root'); 11 test_import('root');
12 test_import('root-and-message'); 12 test_import('root-and-message');
13 13
14 self.addEventListener('install', () => { 14 self.addEventListener('install', () => {
15 test_import('install'); 15 test_import('install');
16 test_import('install-and-message'); 16 test_import('install-and-message');
17 }); 17 });
18 18
19 self.addEventListener('message', e => { 19 self.addEventListener('message', e => {
20 test_import('root-and-message'); 20 var error = null;
21 test_import('install-and-message'); 21
22 // TODO(falken): This should fail. The spec disallows importing a non-cached 22 try {
23 // script like this but currently Chrome and Firefox allow it. 23 importScripts('import-scripts-echo.py?msg=' + e.data);
24 test_import('message'); 24 } catch (e) {
25 e.source.postMessage('OK'); 25 error = e && e.name;
26 }
27
28 e.source.postMessage({ error: error, value: echo_output });
26 }); 29 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698