blob: f4e2d3d5eaea7dc1cd765b93e460320901a09dc1 [file] [log] [blame]
<!DOCTYPE html>
<html>
<head>
<script src="../../http/tests/inspector/resources/inspector-test.js"></script>
<script>
// FIXME: LayoutTest with <video> ends before running any onload handler.
if (window.testRunner)
testRunner.waitUntilDone();
function test()
{
let documentNode = null;
let suite = InspectorTest.createAsyncSuite("DOMNode.ShadowAndNonShadowChildren");
suite.addTestCase({
name: "DOMNode.ShadowAndNonShadowChildren.VideoWithSource",
description: "Check for all children of a video with a source child.",
test(resolve, reject) {
documentNode.querySelector("#test-video", (nodeId) => {
let domNode = WI.domManager.nodeForId(nodeId);
InspectorTest.expectEqual(domNode.nodeName(), "VIDEO", "DOMNode should be a `video` element.");
InspectorTest.expectThat(domNode.hasChildNodes(), "DOMNode should have child nodes.");
InspectorTest.expectThat(domNode.childNodeCount, "DOMNode should indicate it has 2 child nodes.");
InspectorTest.expectNull(domNode.children, "DOMNode children should be null.");
domNode.getChildNodes((children) => {
InspectorTest.assert(children, domNode.children);
InspectorTest.expectEqual(domNode.children.length, 2, "DOMNode should have 2 children.");
InspectorTest.expectThat(domNode.children[0].isShadowRoot(), "DOMNode 1st child should be a ShadowRoot.");
InspectorTest.expectEqual(domNode.children[1].nodeName(), "SOURCE", "DOMNode 2nd child should be a `source` element.");
resolve();
});
});
}
});
WI.domManager.requestDocument((root) => {
documentNode = root;
suite.runTestCasesAndFinish();
});
}
</script>
</head>
<body onload="runTest()">
<p>Test for DOMNode.children of an element with a shadow and non-shadow children.</p>
<video id="test-video" controls><source src="does-not-exist.mp4" type="video/mp4"></video>
</body>
</html>