Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / files / resources / setup-for-read-common.js
bloba04ff90bab7e702628142ea4062aeda7b61fd76e
1 function log(message)
3     document.getElementById('console').appendChild(document.createTextNode(message + "\n"));
4     if (message == "DONE") {
5         if (window && window.testRunner)
6             testRunner.notifyDone();
7     }
10 function onInputFileChange(testFileInfoList)
12     var files = document.getElementById("file").files;
13     var testFiles = { };
14     for (var i = 0; i < files.length; i++)
15         testFiles[testFileInfoList[i]['name']] = files[i];
17     startTest(testFiles);
20 function runTests(testFileInfoList)
22     var pathsOnly = testFileInfoList.map(function(fileSpec) { return fileSpec['path']; });
23     eventSender.beginDragWithFiles(pathsOnly);
24     eventSender.mouseMoveTo(10, 10);
25     eventSender.mouseUp();
28 function startWorker(testFiles, workerScriptURL)
30     var worker = new Worker(workerScriptURL);
31     worker.onmessage = function(event)
32     {
33         log(event.data);
34         if (event.data == "DONE") {
35             if (window.testRunner)
36                 testRunner.notifyDone();
37         }
38     }
39     worker.onerror = function(event)
40     {
41         log("Received error from worker: " + event.message);
42         if (window.testRunner)
43             testRunner.notifyDone();
44     }
45     worker.postMessage(testFiles);