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 renderWorklet.import('resources/empty-worklet-script.js').then(fu nction(undefined_arg) { | |
kinuko
2016/02/15 04:58:27
fyi, for promise chaining we used to use following
ikilpatrick
2016/02/16 19:34:14
Done. (I think).
| |
12 assert_equals(undefined_arg, undefined, 'Promise should resolve with no arguments.'); | |
13 }); | |
14 | |
15 }, 'Importing a script resolves the given promise.'); | |
16 | |
17 promise_test(function() { | |
18 | |
19 return renderWorklet.import('resources/throwing-worklet-script.js').then (function(undefined_arg) { | |
20 assert_equals(undefined_arg, undefined, 'Promise should resolve with no arguments.'); | |
21 }); | |
22 | |
23 }, 'Importing a script which throws should still resolve the given promise.' ); | |
24 | |
25 promise_test(function() { | |
26 | |
27 return renderWorklet.import('non-existant-worklet-script.js').then(funct ion() { | |
28 assert_unreached('import should fail.'); | |
29 }, function(error) { | |
30 assert_equals(error.name, 'NetworkError', 'error should be a Network Error.'); | |
31 }); | |
32 | |
33 }, 'Importing a non-existant script rejects the given promise with a Network Error.'); | |
34 | |
35 promise_test(function() { | |
36 | |
37 return renderWorklet.import('http://invalid:123$').then(function() { | |
38 assert_unreached('import should fail.'); | |
39 }, function(error) { | |
40 assert_equals(error.name, 'SyntaxError', 'error should be a SyntaxEr ror.'); | |
41 }); | |
42 | |
43 }, 'Attempting to resolve an invalid URL should reject the given promise wit h a SyntaxError.'); | |
44 | |
45 </script> | |
46 </body> | |
47 </html> | |
OLD | NEW |