diff options
Diffstat (limited to '')
-rw-r--r-- | dom/worklet/tests/test_import_with_cache.html | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/dom/worklet/tests/test_import_with_cache.html b/dom/worklet/tests/test_import_with_cache.html new file mode 100644 index 0000000000..de1744f9cc --- /dev/null +++ b/dom/worklet/tests/test_import_with_cache.html @@ -0,0 +1,49 @@ +<!DOCTYPE HTML> +<html> +<head> + <title>Test for Worklet</title> + <script src="/tests/SimpleTest/SimpleTest.js"></script> + <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> + <script type="application/javascript" src="common.js"></script> +</head> +<body> + +<script type="application/javascript"> + +function configureTest() { + return SpecialPowers.pushPrefEnv( + {"set": [["dom.audioworklet.enabled", true], + ["dom.worklet.enabled", true]]}); +} + +// This function is called into an iframe. +function runTestInIframe() { + var audioContext = new AudioContext(); + function loading() { + audioContext.audioWorklet.addModule("server_import_with_cache.sjs") + .then(() => { + ok(true, "Import should load a resource."); + }, () => { + ok(false, "Import should load a resource."); + }) + .then(() => { + done(); + }); + } + + var count = 0; + const MAX = 10; + + function done() { + if (++count == MAX) { + SimpleTest.finish(); + } + } + + for (var i = 0; i < MAX; ++i) { + loading(); + } +} +</script> +</body> +</html> |