summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/resources/examples/apisample-worker.js
diff options
context:
space:
mode:
Diffstat (limited to 'testing/web-platform/tests/resources/examples/apisample-worker.js')
-rw-r--r--testing/web-platform/tests/resources/examples/apisample-worker.js34
1 files changed, 34 insertions, 0 deletions
diff --git a/testing/web-platform/tests/resources/examples/apisample-worker.js b/testing/web-platform/tests/resources/examples/apisample-worker.js
new file mode 100644
index 000000000..b1d086314
--- /dev/null
+++ b/testing/web-platform/tests/resources/examples/apisample-worker.js
@@ -0,0 +1,34 @@
+importScripts("../testharness.js");
+
+test(
+ function(test) {
+ assert_true(true, "True is true");
+ },
+ "Worker test that completes successfully");
+
+test(
+ function(test) {
+ assert_true(false, "Failing test");
+ },
+ "Worker test that fails ('FAIL')");
+
+async_test(
+ function(test) {
+ assert_true(true, "True is true");
+ },
+ "Worker test that times out ('TIMEOUT')");
+
+async_test("Worker test that doesn't run ('NOT RUN')");
+
+async_test(
+ function(test) {
+ self.setTimeout(
+ function() {
+ test.done();
+ },
+ 0);
+ },
+ "Worker async_test that completes successfully");
+
+// An explicit done() is required for dedicated and shared web workers.
+done();