| <!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.domManager.querySelector(documentNodeId, "#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((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> |