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

Unified 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 side-by-side diff with in-line comments
Download patch
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..008545f9353fb2fbe1479a4879e149e3927cc871
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/http/tests/worklet/import.html
@@ -0,0 +1,50 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <title></title>
+ <script src="../resources/testharness.js"></script>
+ <script src="../resources/testharnessreport.js"></script>
+</head>
+<body>
+<script>
+ 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.
+ var promise = renderWorklet.import('resources/empty-worklet-script.js');
+
+ promise.then(function(undefined_arg) {
+ assert_equals(undefined_arg, undefined, 'Promise should resolve with no arguments.');
+ t.done();
+ }, function(error) {
+ assert_unreached('import should succeed.');
+ t.done();
+ });
+
+ }, 'Importing a script resolves the given promise.');
+
+ async_test(function(t) {
+ var promise = renderWorklet.import('non-existant-worklet-script.js');
+
+ promise.then(function() {
+ assert_unreached('import should fail.');
+ t.done();
+ }, function(error) {
+ assert_equals(error.name, 'NetworkError', 'error should be a NetworkError.');
+ t.done();
+ });
+
+ }, 'Importing a non-existant script rejects the given promise with a NetworkError.');
+
+ async_test(function(t) {
+ var promise = renderWorklet.import('http://invalid:123$');
+
+ promise.then(function() {
+ assert_unreached('import should fail.');
+ t.done();
+ }, function(error) {
+ assert_equals(error.name, 'SyntaxError', 'error should be a SyntaxError.');
+ t.done();
+ });
+
+ }, 'Attempting to resolve an invalid URL should reject the given promise with a SyntaxError.');
+</script>
+</body>
+</html>

Powered by Google App Engine
This is Rietveld 408576698