blob: e45cb4cb834735afd12e8c840410feb307d90310 [file] [log] [blame]
<!DOCTYPE html>
<html>
<head>
<script src="../../http/tests/inspector/resources/protocol-test.js"></script>
<script>
function test()
{
function assertResponse(response, message) {
InspectorProtocol.checkForError(response);
ProtocolTest.log("PASS: " + message);
}
function evaluate$0() {
InspectorProtocol.sendCommand("Runtime.evaluate", {"expression": "$0.id", "includeCommandLineAPI": true}, (response) => {
assertResponse(response, "Evaluate $0.");
ProtocolTest.expectEqual(response.result.result.value, "target", "Id of $0 is \"target\".");
ProtocolTest.completeTest();
});
}
function setInspectedNode(nodeId) {
InspectorProtocol.sendCommand("DOM.setInspectedNode", {nodeId}, (response) => {
assertResponse(response, "Set $0 to the target node.");
evaluate$0();
});
}
function queryForTarget(nodeId) {
InspectorProtocol.sendCommand("DOM.querySelector", {nodeId, selector: "#target"}, (response) => {
assertResponse(response, "Queryied for target node.");
setInspectedNode(response.result.nodeId);
});
}
InspectorProtocol.sendCommand("DOM.getDocument", {}, (response) => {
assertResponse(response, "Got document.");
queryForTarget(response.result.root.nodeId);
});
}
</script>
</head>
<body onload="runTest()">
<p>Test for basic DOM.events.inspect functionality.</p>
<div id="target"></div>
</body>
</html>