Chromium Code Reviews| Index: third_party/WebKit/LayoutTests/http/tests/worklet/import.html |
| diff --git a/third_party/WebKit/LayoutTests/http/tests/worklet/import.html b/third_party/WebKit/LayoutTests/http/tests/worklet/import.html |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..74a08d922fa6ca78175a60d4d5264ac1fade8d19 |
| --- /dev/null |
| +++ b/third_party/WebKit/LayoutTests/http/tests/worklet/import.html |
| @@ -0,0 +1,47 @@ |
| +<!DOCTYPE html> |
| +<html> |
| +<head> |
| + <script src="../resources/testharness.js"></script> |
| + <script src="../resources/testharnessreport.js"></script> |
| +</head> |
| +<body> |
| +<script> |
| + promise_test(function() { |
| + |
| + return renderWorklet.import('resources/empty-worklet-script.js').then(function(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).
|
| + assert_equals(undefined_arg, undefined, 'Promise should resolve with no arguments.'); |
| + }); |
| + |
| + }, 'Importing a script resolves the given promise.'); |
| + |
| + promise_test(function() { |
| + |
| + return renderWorklet.import('resources/throwing-worklet-script.js').then(function(undefined_arg) { |
| + assert_equals(undefined_arg, undefined, 'Promise should resolve with no arguments.'); |
| + }); |
| + |
| + }, 'Importing a script which throws should still resolve the given promise.'); |
| + |
| + promise_test(function() { |
| + |
| + return renderWorklet.import('non-existant-worklet-script.js').then(function() { |
| + assert_unreached('import should fail.'); |
| + }, function(error) { |
| + assert_equals(error.name, 'NetworkError', 'error should be a NetworkError.'); |
| + }); |
| + |
| + }, 'Importing a non-existant script rejects the given promise with a NetworkError.'); |
| + |
| + promise_test(function() { |
| + |
| + return renderWorklet.import('http://invalid:123$').then(function() { |
| + assert_unreached('import should fail.'); |
| + }, function(error) { |
| + assert_equals(error.name, 'SyntaxError', 'error should be a SyntaxError.'); |
| + }); |
| + |
| + }, 'Attempting to resolve an invalid URL should reject the given promise with a SyntaxError.'); |
| + |
| +</script> |
| +</body> |
| +</html> |