diff options
Diffstat (limited to 'testing/web-platform/tests/workers/Worker_basic.htm')
-rw-r--r-- | testing/web-platform/tests/workers/Worker_basic.htm | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/testing/web-platform/tests/workers/Worker_basic.htm b/testing/web-platform/tests/workers/Worker_basic.htm new file mode 100644 index 0000000000..d2b57b4918 --- /dev/null +++ b/testing/web-platform/tests/workers/Worker_basic.htm @@ -0,0 +1,31 @@ +<!DOCTYPE html> +<title> Web Workers Basic Tests </title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<div id=log></div> +<script> +function create_worker() { + return new Worker('./support/WorkerBasic.js'); +} + +test(function() { + var worker = create_worker(); + assert_class_string(worker, "Worker"); +}, "Worker constructor"); + +async_test(function(t) { + var worker = create_worker(); + worker.onmessage = t.step_func_done(function(e) { + assert_equals(e.data, "Pass"); + }); + worker.postMessage("start"); +}, "MessageEvent.data"); + +async_test(function(t) { + var worker = create_worker(); + worker.addEventListener("message", t.step_func_done(function(e) { + assert_equals(e.type, "message"); + }), true); + worker.postMessage("start"); +}, "MessageEvent.type"); +</script> |