blob: db67343ec9269144255b3f48fbcbcd065db3bf37 [file] [log] [blame]
<!doctype html>
<html>
<head>
<style>
#flow1
{
-webkit-flow-into: flow1;
}
</style>
<script src="../../http/tests/inspector/resources/inspector-test.js"></script>
<script>
function addFlow() {
let div = document.createElement("div");
div.id = "flow1";
document.body.appendChild(div);
}
function removeFlow() {
document.getElementById("flow1").remove();
}
function test()
{
let domTree;
function onRootDOMNodeInvalidated()
{
domTree.requestContentFlowList();
InspectorTest.evaluateInPage("addFlow()");
}
function onContentFlowWasAdded(event)
{
InspectorTest.expectEqual(event.data.flow.name, "flow1", "ContentFlow was added");
InspectorTest.expectEqual(domTree.contentFlowCollection.items.size, 1, "Flow count is 1");
InspectorTest.evaluateInPage("removeFlow()");
}
function onContentFlowWasRemoved(event)
{
InspectorTest.expectEqual(event.data.flow.name, "flow1", "ContentFlow was removed");
InspectorTest.expectEqual(domTree.contentFlowCollection.items.size, 0, "Flow count is 0");
InspectorTest.completeTest();
}
WI.Frame.addEventListener(WI.Frame.Event.MainResourceDidChange, function() {
domTree = WI.frameResourceManager.mainFrame.domTree;
domTree.addEventListener(WI.DOMTree.Event.RootDOMNodeInvalidated, onRootDOMNodeInvalidated);
domTree.addEventListener(WI.DOMTree.Event.ContentFlowWasAdded, onContentFlowWasAdded);
domTree.addEventListener(WI.DOMTree.Event.ContentFlowWasRemoved, onContentFlowWasRemoved);
domTree.requestContentFlowList();
});
InspectorTest.reloadPage();
}
</script>
</head>
<body onload="runTest()">
<p>Testing that the ContentFlows events are correctly dispatched when new flows are created/removed.</p>
</body>
</html>