2010-05-28 Eric Uhrhane <ericu@chromium.org>
[WebKit-https.git] / LayoutTests / fast / workers / storage / resources / test-inputs-common.js
1 function log(message)
2 {
3     document.getElementById("console").innerHTML += message + "<br>";
4 }
5
6 function finishTest()
7 {
8     if (window.layoutTestController)
9         layoutTestController.notifyDone();
10 }
11
12 function runTest(workerJSFile)
13 {
14     if (!workerJSFile) {
15         log("FAIL: no JS file specified for the worker.");
16     }
17
18     if (window.layoutTestController) {
19         layoutTestController.dumpAsText();
20         layoutTestController.waitUntilDone();
21     }
22
23     var worker = new Worker(workerJSFile);
24     worker.onmessage = function(event) {
25         if (event.data == "done")
26             finishTest();
27         else
28             log(event.data);
29     }
30 }