<!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 documentNodeId;
    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) {
            WI.domTreeManager.querySelector(documentNodeId, "#test-video", (nodeId) => {
                let domNode = WI.domTreeManager.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.domTreeManager.requestDocument((documentNode) => {
        documentNodeId = documentNode.id;
        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>
