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

Side by Side Diff: third_party/WebKit/LayoutTests/http/tests/worklet/chromium/import-on-detached-iframe.html

Issue 2826983002: Rename Worklet.import() to Worklet.addModule(). (Closed)
Patch Set: Fixing Layout Tests Created 3 years, 8 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 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <meta charset="utf-8"> 2 <meta charset="utf-8">
3 <title>Worklet: import() on a detached iframe</title> 3 <title>Worklet: addModule() on a detached iframe</title>
4 <body> 4 <body>
5 </body> 5 </body>
6 <script src="../../resources/testharness.js"></script> 6 <script src="../../resources/testharness.js"></script>
7 <script src="../../resources/testharnessreport.js"></script> 7 <script src="../../resources/testharnessreport.js"></script>
8 <script> 8 <script>
9 9
10 function with_iframe(url) { 10 function with_iframe(url) {
11 return new Promise(resolve => { 11 return new Promise(resolve => {
12 let frame = document.createElement('iframe'); 12 let frame = document.createElement('iframe');
13 frame.src = url; 13 frame.src = url;
14 frame.onload = () => { resolve(frame); }; 14 frame.onload = () => { resolve(frame); };
15 document.body.appendChild(frame); 15 document.body.appendChild(frame);
16 add_result_callback(() => frame.remove()); 16 add_result_callback(() => frame.remove());
17 }); 17 });
18 } 18 }
19 19
20 // This test should be in chromium/ because the spec does not define behavior in 20 // This test should be in chromium/ because the spec does not define behavior in
21 // the case where import() is called from a detached frame. 21 // the case where addModule() is called from a detached frame.
22 promise_test(t => { 22 promise_test(t => {
23 const kFrameUrl = 'resources/blank.html'; 23 const kFrameUrl = 'resources/blank.html';
24 const kScriptUrl = 'resources/empty-worklet-script.js'; 24 const kScriptUrl = 'resources/empty-worklet-script.js';
25 25
26 return with_iframe(kFrameUrl) 26 return with_iframe(kFrameUrl)
27 .then(frame => { 27 .then(frame => {
28 let worklet = frame.contentWindow.paintWorklet; 28 let worklet = frame.contentWindow.paintWorklet;
29 frame.remove(); 29 frame.remove();
30 return worklet.import(kScriptUrl); 30 return worklet.addModule(kScriptUrl);
31 }) 31 })
32 .then(() => assert_unreached('import() should fail.')) 32 .then(() => assert_unreached('addModule() should fail.'))
33 .catch(e => assert_equals(e.name, 'InvalidStateError', e)); 33 .catch(e => assert_equals(e.name, 'InvalidStateError', e));
34 }, 'import() on a detached iframe should be rejected.'); 34 }, 'addModule() on a detached iframe should be rejected.');
35 35
36 </script> 36 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698