Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / workers / resources / worker-lifecycle.js
blob63b48d938262ec431b17b8a48fbd6dfc7f6d7c33
2 if (window.testRunner) {
3 testRunner.dumpAsText();
4 testRunner.waitUntilDone();
5 waitUntilWorkerThreadsExit(runTests);
6 } else {
7 log("NOTE: Test relies on window.testRunner to detect when worker threads have exited. Please run this test via DumpRenderTree");
8 waitUntilWorkerThreadsExit(runTests);
11 function runTests()
13 if (window.testRunner)
14 log("PASS: workerThreadCount = " + internals.workerThreadCount);
15 var worker = createWorker();
16 worker.postMessage("ping");
17 worker.onmessage = function(event) {
18 if (window.testRunner) {
19 if (internals.workerThreadCount == 1)
20 log("PASS: Worker thread created");
21 else
22 log("FAIL: After thread creation: internals.workerThreadCount = " + internals.workerThreadCount);
25 // Shutdown the worker.
26 worker.postMessage("close");
27 waitUntilWorkerThreadsExit(workerExited);
31 function workerExited()
33 log("PASS: Worker exited when close() called.");
34 done();