Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / inspector-protocol / dom / dom-setInspectModeEnabled.html
blob24432f9c0364e39ff83e0d14f00dba7c3f494a1b
1 <html>
2 <head>
3 <script type="text/javascript" src="../../http/tests/inspector-protocol/inspector-protocol-test.js"></script>
4 <script>
6 function test()
8 var nodeInfo = {};
9 InspectorTest.eventHandler["DOM.setChildNodes"] = setChildNodes;
10 InspectorTest.eventHandler["DOM.inspectNodeRequested"] = inspectNodeRequested;
11 InspectorTest.sendCommand("DOM.enable", {});
12 InspectorTest.sendCommand("DOM.setInspectMode", { "mode": "searchForNode", highlightConfig: {} }, onSetModeEnabled);
14 function onSetModeEnabled(message)
16 if (message.error) {
17 InspectorTest.log(message.error.message);
18 InspectorTest.completeTest();
19 return;
22 InspectorTest.sendCommand("Input.dispatchMouseEvent", { "type": "mouseMoved", "button": "left", "clickCount": 1, "x": 150, "y": 150 });
23 InspectorTest.sendCommand("Input.dispatchMouseEvent", { "type": "mousePressed", "button": "left", "clickCount": 1, "x": 150, "y": 150 });
24 InspectorTest.sendCommand("Input.dispatchMouseEvent", { "type": "mouseReleased", "button": "left", "clickCount": 1, "x": 150, "y": 150 });
27 function setChildNodes(message)
29 var nodes = message.params.nodes;
30 for (var i = 0; i < nodes.length; ++i) {
31 nodeInfo[nodes[i].nodeId] = nodes[i];
32 delete nodes[i].nodeId;
36 function inspectNodeRequested(message)
38 InspectorTest.sendCommand("DOM.pushNodesByBackendIdsToFrontend", { "backendNodeIds": [ message.params.backendNodeId ] }, onNodeResolved);
41 function onNodeResolved(message)
43 InspectorTest.log("DOM.inspectNodeRequested: " + nodeInfo[message.result.nodeIds[0]].localName);
44 InspectorTest.completeTest();
48 </script>
49 </head>
50 <body onload="runTest()">
51 <div style="position:absolute;top:100;left:100;width:100;height:100;background:black"></div>
52 </body>
53 </html>