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