Chromium Code Reviews| Index: third_party/WebKit/LayoutTests/inspector-protocol/dom/dom-requestChildNodes.html |
| diff --git a/third_party/WebKit/LayoutTests/inspector-protocol/dom/dom-requestChildNodes.html b/third_party/WebKit/LayoutTests/inspector-protocol/dom/dom-requestChildNodes.html |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..51a008401684cf07383e12a31098a68fed7284ed |
| --- /dev/null |
| +++ b/third_party/WebKit/LayoutTests/inspector-protocol/dom/dom-requestChildNodes.html |
| @@ -0,0 +1,80 @@ |
| +<html> |
| +<head> |
| +<script type="text/javascript" src="../../http/tests/inspector-protocol/inspector-protocol-test.js"></script> |
| +<script type="text/javascript"> |
| + |
| +function test() |
| +{ |
| + getDocument(); |
| + |
| + function getDocument() |
| + { |
| + InspectorTest.sendCommand("DOM.getDocument", {}, function(messageObject) { |
| + if (messageObject.hasOwnProperty("error")) |
|
Sami
2016/09/27 13:50:58
Is this block indented right?
alex clarke (OOO till 29th)
2016/09/27 13:56:07
Done.
|
| + InspectorTest.log("Backend error: " + messageObject.error.message + " (" + messageObject.error.code + ")\n"); |
| + |
| + var bodyId = messageObject.result.root.children[0].children[1].nodeId; |
| + requestChildNodesNotIncludingIframeChildren(bodyId); |
| + }); |
| + }; |
| + |
| + function requestChildNodesNotIncludingIframeChildren(bodyId) |
| + { |
| + InspectorTest.sendCommand("DOM.requestChildNodes", {"nodeId": bodyId, "depth": 10}, function(messageObject) { |
| + if (messageObject.hasOwnProperty("error")) |
| + InspectorTest.log("Backend error: " + messageObject.error.message + " (" + messageObject.error.code + ")\n"); |
| + }); |
| + |
| + InspectorTest.eventHandler["DOM.setChildNodes"] = function(messageObject) |
| + { |
| + var iframeNode = messageObject.params.nodes[0].children[0].children[0].children[0]; |
| + if (iframeNode.children.length !== 0) { |
| + InspectorTest.log("Error IFrame node should not include children: " + JSON.stringify(iframeNode, null, " ")); |
| + InspectorTest.completeTest(); |
| + } else { |
| + requestAllChildNodes(bodyId); |
| + } |
| + }; |
| + }; |
| + |
| + function requestAllChildNodes(bodyId) |
| + { |
| + InspectorTest.sendCommand("DOM.requestChildNodes", {"nodeId": bodyId, "depth": -1}, function(messageObject) { |
| + if (messageObject.hasOwnProperty("error")) |
| + InspectorTest.log("Backend error: " + messageObject.error.message + " (" + messageObject.error.code + ")\n"); |
| + }); |
| + |
| + InspectorTest.eventHandler["DOM.setChildNodes"] = function(messageObject) |
| + { |
| + // FrameIds change every time, so replace them. |
| + messageObject.params.nodes[0].children[0].children[0].children[0].frameId = "???"; |
| + messageObject.params.nodes[0].children[0].children[0].children[0].children[0].frameId = "???"; |
| + |
| + // The contentDocument's documentURL & baseURL are absolute paths. |
| + messageObject.params.nodes[0].children[0].children[0].children[0].contentDocument.documentURL = "???"; |
| + messageObject.params.nodes[0].children[0].children[0].children[0].contentDocument.baseURL = "???"; |
| + |
| + InspectorTest.log(JSON.stringify(messageObject, null, " ")); |
| + InspectorTest.completeTest(); |
| + }; |
| + }; |
| +}; |
| + |
| +window.addEventListener("DOMContentLoaded", function () { |
| + runTest(); |
| +}, false); |
| + |
| +</script> |
| +</head> |
| +<body> |
| + |
| +<div id="depth-1"> |
| + <div id="depth-2"> |
| + <div id="depth-3"> |
| + <iframe src="resources/iframe.html"></iframe> |
| + </div> |
| + </div> |
| +</div> |
| + |
| +</body> |
| +</html> |