Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(114)

Unified Diff: third_party/WebKit/LayoutTests/http/tests/worklet/resources/import-tests.js

Issue 2657823002: Worklet: Straighten layering of worklet script loading (Closed)
Patch Set: clean up Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/workers/Worklet.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..ea341b8af574d8e90d10294c4b4cea8199da1134 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
@@ -8,39 +8,38 @@ function runImportTests(worklet, opt_path) {
promise_test(function() {
return worklet.import(path + 'resources/empty-worklet-script.js').then(function(undefined_arg) {
assert_equals(undefined_arg, undefined, 'Promise should resolve with no arguments.');
- }).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.');
+ });
+ }, '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) {
- 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.');
}
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/workers/Worklet.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698