Chromium Code Reviews| Index: third_party/WebKit/LayoutTests/http/tests/worklet/resources/import-tests.js |
| diff --git a/third_party/WebKit/LayoutTests/http/tests/worklet/resources/import-tests.js b/third_party/WebKit/LayoutTests/http/tests/worklet/resources/import-tests.js |
| index 90bd4e98fe0ab8be0987090160e477595b3798e5..ee3c904c700bca48c0864e720b074668c7187aed 100644 |
| --- a/third_party/WebKit/LayoutTests/http/tests/worklet/resources/import-tests.js |
| +++ b/third_party/WebKit/LayoutTests/http/tests/worklet/resources/import-tests.js |
| @@ -11,36 +11,41 @@ function runImportTests(worklet, opt_path) { |
| }).catch(function(error) { |
| assert_unreached('unexpected rejection: ' + error); |
| }); |
| - |
| }, 'Importing a script resolves the given promise.'); |
| promise_test(function() { |
| + return Promise.all([ |
| + worklet.import(path + 'resources/empty-worklet-script.js?1'), |
| + worklet.import(path + 'resources/empty-worklet-script.js?2'), |
| + worklet.import(path + 'resources/empty-worklet-script.js?3') |
| + ]).then(function(undefined_args) { |
| + assert_array_equals(undefined_args, [undefined, undefined, undefined], 'Promise should resolve with no arguments.'); |
| + }).catch(function(error) { |
| + assert_unreached('unexpected rejection: ' + error); |
|
yhirano
2017/01/25 10:49:20
You don't need this catch section.
nhiroki
2017/01/27 04:40:33
Done.
|
| + }); |
| + }, 'Importing scripts resolves all the given promises.'); |
| + promise_test(function() { |
| return worklet.import(path + 'resources/throwing-worklet-script.js').then(function(undefined_arg) { |
| assert_equals(undefined_arg, undefined, 'Promise should resolve with no arguments.'); |
| }).catch(function(error) { |
|
yhirano
2017/01/25 10:49:20
ditto (though unrelated to this CL)
nhiroki
2017/01/27 04:40:33
Done.
|
| assert_unreached('unexpected rejection: ' + error); |
| }); |
| - |
| }, 'Importing a script which throws should still resolve the given promise.'); |
| promise_test(function() { |
| - |
| return worklet.import(path + 'non-existant-worklet-script.js').then(function() { |
| assert_unreached('import should fail.'); |
| }).catch(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 worklet.import('http://invalid:123$').then(function() { |
| assert_unreached('import should fail.'); |
| }).catch(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.'); |
| } |