Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / inspector-protocol / debugger / debugger-step-into-dedicated-worker.html
blob45a0bfab2b1e168389056341b3cec43f96b55eec
1 <html>
2 <head>
3 <script type="text/javascript" src="../../http/tests/inspector-protocol/inspector-protocol-test.js"></script>
4 <script>
5 var worker;
7 function startWorker()
9 worker = new Worker("resources/dedicated-worker-step-into.js");
10 worker.onmessage = function(event) { };
11 worker.postMessage(1);
12 log("Started worker");
16 function test()
19 var workerId;
20 var workerRequestId = 1;
21 function sendCommandToWorker(method, params)
23 InspectorTest.sendCommand("Worker.sendMessageToWorker",
25 "workerId": workerId,
26 "message": JSON.stringify({ "method": method,
27 "params": params,
28 "id": workerRequestId++ })
29 });
32 function didEnableWorkerDebugging(messageObject)
34 if ("error" in messageObject) {
35 InspectorTest.log("FAIL: Couldn't enable worker debugger: " + messageObject.error.message);
36 InspectorTest.completeTest();
39 InspectorTest.sendCommand("Worker.enable", {}, didEnableWorkerDebugging);
40 InspectorTest.sendCommand("Worker.setAutoconnectToWorkers", { "value": true });
41 InspectorTest.sendCommand("Runtime.evaluate", { "expression": "startWorker()" });
43 InspectorTest.eventHandler["Worker.workerCreated"] = function(messageObject)
45 workerId = messageObject["params"]["workerId"];
46 InspectorTest.log("Worker created");
47 sendCommandToWorker("Debugger.enable", {});
48 sendCommandToWorker("Runtime.run", {});
51 var pauseCount = 0;
52 InspectorTest.eventHandler["Worker.dispatchMessageFromWorker"] = function(messageObject)
54 var message = JSON.parse(messageObject["params"]["message"]);
55 if (message["method"] === "Debugger.paused") {
56 InspectorTest.log("SUCCESS: Worker paused");
57 if (++pauseCount === 1) {
58 InspectorTest.log("Stepping into...");
59 sendCommandToWorker("Debugger.stepInto", {});
60 } else {
61 sendCommandToWorker("Debugger.disable", {});
62 InspectorTest.completeTest();
68 </script>
69 </head>
70 <body onLoad="runTest();">
71 <p>Tests that dedicated worker won't crash on attempt to step into.<a href="https://code.google.com/p/chromium/issues/detail?id=232392">Bug 232392.</a>
72 </p>
73 </body>
74 </html>