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

Side by Side Diff: third_party/WebKit/LayoutTests/http/tests/worklet/import.html

Issue 1684303002: Add a basic version of Worklet#import. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: adressed comments. Created 4 years, 10 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 unified diff | Download patch
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/http/tests/worklet/resources/empty-worklet-script.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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>
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/http/tests/worklet/resources/empty-worklet-script.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698