OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <html> |
| 3 <head> |
| 4 <script src="../resources/testharness.js"></script> |
| 5 <script src="../resources/testharnessreport.js"></script> |
| 6 </head> |
| 7 <body> |
| 8 <script> |
| 9 promise_test(function() { |
| 10 |
| 11 return paintWorklet.import('resources/empty-worklet-script.js').then(fun
ction(undefined_arg) { |
| 12 assert_equals(undefined_arg, undefined, 'Promise should resolve with
no arguments.'); |
| 13 }).catch(function(error) { |
| 14 assert_unreached('unexpected rejection: ' + error); |
| 15 }); |
| 16 |
| 17 }, 'Importing a script resolves the given promise.'); |
| 18 |
| 19 promise_test(function() { |
| 20 |
| 21 return paintWorklet.import('resources/throwing-worklet-script.js').then(
function(undefined_arg) { |
| 22 assert_equals(undefined_arg, undefined, 'Promise should resolve with
no arguments.'); |
| 23 }).catch(function(error) { |
| 24 assert_unreached('unexpected rejection: ' + error); |
| 25 }); |
| 26 |
| 27 }, 'Importing a script which throws should still resolve the given promise.'
); |
| 28 |
| 29 promise_test(function() { |
| 30 |
| 31 return paintWorklet.import('non-existant-worklet-script.js').then(functi
on() { |
| 32 assert_unreached('import should fail.'); |
| 33 }).catch(function(error) { |
| 34 assert_equals(error.name, 'NetworkError', 'error should be a Network
Error.'); |
| 35 }); |
| 36 |
| 37 }, 'Importing a non-existant script rejects the given promise with a Network
Error.'); |
| 38 |
| 39 promise_test(function() { |
| 40 |
| 41 return paintWorklet.import('http://invalid:123$').then(function() { |
| 42 assert_unreached('import should fail.'); |
| 43 }).catch(function(error) { |
| 44 assert_equals(error.name, 'SyntaxError', 'error should be a SyntaxEr
ror.'); |
| 45 }); |
| 46 |
| 47 }, 'Attempting to resolve an invalid URL should reject the given promise wit
h a SyntaxError.'); |
| 48 |
| 49 </script> |
| 50 </body> |
| 51 </html> |
OLD | NEW |