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

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: 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
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <title></title>
5 <script src="../resources/testharness.js"></script>
6 <script src="../resources/testharnessreport.js"></script>
7 </head>
8 <body>
9 <script>
10 async_test(function(t) {
kinuko 2016/02/12 07:25:44 nit: you could also use promise_test to save some
ikilpatrick 2016/02/12 22:59:57 Done.
11 var promise = renderWorklet.import('resources/empty-worklet-script.js');
12
13 promise.then(function(undefined_arg) {
14 assert_equals(undefined_arg, undefined, 'Promise should resolve with no arguments.');
15 t.done();
16 }, function(error) {
17 assert_unreached('import should succeed.');
18 t.done();
19 });
20
21 }, 'Importing a script resolves the given promise.');
22
23 async_test(function(t) {
24 var promise = renderWorklet.import('non-existant-worklet-script.js');
25
26 promise.then(function() {
27 assert_unreached('import should fail.');
28 t.done();
29 }, function(error) {
30 assert_equals(error.name, 'NetworkError', 'error should be a Network Error.');
31 t.done();
32 });
33
34 }, 'Importing a non-existant script rejects the given promise with a Network Error.');
35
36 async_test(function(t) {
37 var promise = renderWorklet.import('http://invalid:123$');
38
39 promise.then(function() {
40 assert_unreached('import should fail.');
41 t.done();
42 }, function(error) {
43 assert_equals(error.name, 'SyntaxError', 'error should be a SyntaxEr ror.');
44 t.done();
45 });
46
47 }, 'Attempting to resolve an invalid URL should reject the given promise wit h a SyntaxError.');
48 </script>
49 </body>
50 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698