blob: fa30f017892f8f4584bb867e53d5f06c77eff0ab [file] [log] [blame]
<html>
<head>
<script src="../../../http/tests/inspector/inspector-test.js"></script>
<script src="../../../http/tests/inspector/elements-test.js"></script>
<script>
function test()
{
var htmlNode;
var bodyNode;
var headNode;
InspectorTest.runTestSuite([
function testSetUp(next)
{
InspectorTest.expandElementsTree(step1);
function step1()
{
htmlNode = InspectorTest.expandedNodeWithId("html");
headNode = InspectorTest.expandedNodeWithId("head");
bodyNode = InspectorTest.expandedNodeWithId("body");
next();
}
},
function testSetBody(next)
{
InspectorTest.DOMAgent.setOuterHTML(bodyNode.id, "<body>New body content</body>").then(dumpHTML(next));
},
function testInsertComments(next)
{
InspectorTest.DOMAgent.setOuterHTML(bodyNode.id, "<!-- new comment between head and body --><body>New body content</body>").then(dumpHTML(next));
},
function testSetHead(next)
{
InspectorTest.DOMAgent.setOuterHTML(headNode.id, "<head><!-- new head content --></head>").then(dumpHTML(next));
},
function testSetHTML(next)
{
InspectorTest.DOMAgent.setOuterHTML(
htmlNode.id, "<html><head><!-- new head content --></head><body>Setting body as a part of HTML.</body></html>").then(dumpHTML(next));
}
]);
function dumpHTML(next)
{
async function dump()
{
var text = await InspectorTest.DOMAgent.getOuterHTML(htmlNode.id);
InspectorTest.addResult(text);
next();
}
return dump;
}
}
</script>
</head>
<body>
<p>
Tests DOMAgent.setOuterHTML invoked on body tag. See https://bugs.webkit.org/show_bug.cgi?id=62272.
<iframe src="../resources/set-outer-html-body-iframe.html" onload="runTest()"></iframe>
</p>
</body>
</html>