| OLD | NEW |
| 1 <html> | 1 <html> |
| 2 <head> | 2 <head> |
| 3 <script type="text/javascript" src="../../http/tests/inspector-protocol/resource
s/inspector-protocol-test.js"></script> | 3 <script type="text/javascript" src="../../http/tests/inspector-protocol/resource
s/inspector-protocol-test.js"></script> |
| 4 <script> | 4 <script> |
| 5 var worker; | 5 var worker; |
| 6 | 6 |
| 7 function startWorker() | 7 function startWorker() |
| 8 { | 8 { |
| 9 worker = new Worker("resources/dedicated-worker-suspend-setTimeout.js"); | 9 worker = new Worker("resources/dedicated-worker-suspend-setTimeout.js"); |
| 10 worker.onmessage = function(event) { }; | 10 worker.onmessage = function(event) { }; |
| 11 worker.postMessage(1); | 11 worker.postMessage(1); |
| 12 log("Started worker"); | 12 log("Started worker"); |
| 13 } | 13 } |
| 14 | 14 |
| 15 | 15 |
| 16 function test() | 16 function test() |
| 17 { | 17 { |
| 18 | 18 |
| 19 var workerId; | 19 var workerSessionId; |
| 20 var workerRequestId = 1; | 20 var workerRequestId = 1; |
| 21 function sendCommandToWorker(method, params) | 21 function sendCommandToWorker(method, params) |
| 22 { | 22 { |
| 23 var requestId = workerRequestId++; | 23 var requestId = workerRequestId++; |
| 24 InspectorTest.sendCommand("Target.sendMessageToTarget", | 24 InspectorTest.sendCommand("Target.sendMessageToTarget", |
| 25 { | 25 { |
| 26 "targetId": workerId, | 26 "sessionId": workerSessionId, |
| 27 "message": JSON.stringify({ "method": method, | 27 "message": JSON.stringify({ "method": method, |
| 28 "params": params, | 28 "params": params, |
| 29 "id": requestId }) | 29 "id": requestId }) |
| 30 }); | 30 }); |
| 31 return requestId; | 31 return requestId; |
| 32 } | 32 } |
| 33 | 33 |
| 34 function didEnableWorkerDebugging(messageObject) | 34 function didEnableWorkerDebugging(messageObject) |
| 35 { | 35 { |
| 36 if ("error" in messageObject) { | 36 if ("error" in messageObject) { |
| 37 InspectorTest.log("FAIL: Couldn't enable worker debugger: " + messag
eObject.error.message); | 37 InspectorTest.log("FAIL: Couldn't enable worker debugger: " + messag
eObject.error.message); |
| 38 InspectorTest.completeTest(); | 38 InspectorTest.completeTest(); |
| 39 } | 39 } |
| 40 } | 40 } |
| 41 InspectorTest.sendCommand("Target.setAutoAttach", {autoAttach: true, waitFor
DebuggerOnStart: true}, didEnableWorkerDebugging); | 41 InspectorTest.sendCommand("Target.setAutoAttach", {autoAttach: true, waitFor
DebuggerOnStart: true}, didEnableWorkerDebugging); |
| 42 InspectorTest.sendCommand("Runtime.evaluate", { "expression": "startWorker()
" }); | 42 InspectorTest.sendCommand("Runtime.evaluate", { "expression": "startWorker()
" }); |
| 43 | 43 |
| 44 InspectorTest.eventHandler["Target.attachedToTarget"] = function(messageObje
ct) | 44 InspectorTest.eventHandler["Target.attachedToTarget"] = function(messageObje
ct) |
| 45 { | 45 { |
| 46 workerId = messageObject["params"]["targetInfo"]["targetId"]; | 46 workerSessionId = messageObject["params"]["sessionId"]; |
| 47 InspectorTest.log("Worker created"); | 47 InspectorTest.log("Worker created"); |
| 48 sendCommandToWorker("Debugger.enable", {}); | 48 sendCommandToWorker("Debugger.enable", {}); |
| 49 sendCommandToWorker("Runtime.runIfWaitingForDebugger", {}); | 49 sendCommandToWorker("Runtime.runIfWaitingForDebugger", {}); |
| 50 } | 50 } |
| 51 | 51 |
| 52 var pauseCount = 0; | 52 var pauseCount = 0; |
| 53 var evalRequestId; | 53 var evalRequestId; |
| 54 InspectorTest.eventHandler["Target.receivedMessageFromTarget"] = function(me
ssageObject) | 54 InspectorTest.eventHandler["Target.receivedMessageFromTarget"] = function(me
ssageObject) |
| 55 { | 55 { |
| 56 var message = JSON.parse(messageObject["params"]["message"]); | 56 var message = JSON.parse(messageObject["params"]["message"]); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 73 } | 73 } |
| 74 } | 74 } |
| 75 } | 75 } |
| 76 </script> | 76 </script> |
| 77 </head> | 77 </head> |
| 78 <body onLoad="runTest();"> | 78 <body onLoad="runTest();"> |
| 79 <p>Tests that setTimeout callback will not fire while script execution is paused
.<a href="https://code.google.com/p/chromium/issues/detail?id=377926">Bug 377926
.</a> | 79 <p>Tests that setTimeout callback will not fire while script execution is paused
.<a href="https://code.google.com/p/chromium/issues/detail?id=377926">Bug 377926
.</a> |
| 80 </p> | 80 </p> |
| 81 </body> | 81 </body> |
| 82 </html> | 82 </html> |
| OLD | NEW |