| Index: third_party/WebKit/LayoutTests/http/tests/worklet/resources/import-tests.js
|
| diff --git a/third_party/WebKit/LayoutTests/http/tests/worklet/import.html b/third_party/WebKit/LayoutTests/http/tests/worklet/resources/import-tests.js
|
| similarity index 68%
|
| rename from third_party/WebKit/LayoutTests/http/tests/worklet/import.html
|
| rename to third_party/WebKit/LayoutTests/http/tests/worklet/resources/import-tests.js
|
| index 2b99c5c254cbd33e3b7dab0b0d3c1e73a1771b3b..90bd4e98fe0ab8be0987090160e477595b3798e5 100644
|
| --- a/third_party/WebKit/LayoutTests/http/tests/worklet/import.html
|
| +++ b/third_party/WebKit/LayoutTests/http/tests/worklet/resources/import-tests.js
|
| @@ -1,14 +1,12 @@
|
| -<!DOCTYPE html>
|
| -<html>
|
| -<head>
|
| - <script src="../resources/testharness.js"></script>
|
| - <script src="../resources/testharnessreport.js"></script>
|
| -</head>
|
| -<body>
|
| -<script>
|
| - promise_test(function() {
|
| +// Runs a series of tests related to importing scripts on a worklet.
|
| +//
|
| +// Usage:
|
| +// runImportTests(workletType);
|
| +function runImportTests(worklet, opt_path) {
|
| + const path = opt_path || '';
|
|
|
| - return paintWorklet.import('resources/empty-worklet-script.js').then(function(undefined_arg) {
|
| + 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);
|
| @@ -18,7 +16,7 @@
|
|
|
| promise_test(function() {
|
|
|
| - return paintWorklet.import('resources/throwing-worklet-script.js').then(function(undefined_arg) {
|
| + 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);
|
| @@ -28,7 +26,7 @@
|
|
|
| promise_test(function() {
|
|
|
| - return paintWorklet.import('non-existant-worklet-script.js').then(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.');
|
| @@ -38,14 +36,11 @@
|
|
|
| promise_test(function() {
|
|
|
| - return paintWorklet.import('http://invalid:123$').then(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.');
|
| -
|
| -</script>
|
| -</body>
|
| -</html>
|
| +}
|
|
|