Revision b2e3ab765e26436850208dbdcf747c3be75b1999 authored by Ben Kelly on 08 April 2016, 10:47:01 UTC, committed by James Graham on 08 April 2016, 11:00:29 UTC
Upstreamed from https://bugzilla.mozilla.org/show_bug.cgi?id=1262624
1 parent db9c8c9
Raw File
Worker_basic.htm
<!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>
back to top