summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/LayoutTests/inspector/elements/set-outer-html-body.html
blob: dcfdf966e40f2b231f9e60352a2538ce546963a4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
<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)
        {
            DOMAgent.setOuterHTML(bodyNode.id, "<body>New body content</body>", dumpHTML(next));
        },

        function testInsertComments(next)
        {
            DOMAgent.setOuterHTML(bodyNode.id, "<!-- new comment between head and body --><body>New body content</body>", dumpHTML(next));
        },

        function testSetHead(next)
        {
            DOMAgent.setOuterHTML(headNode.id, "<head><!-- new head content --></head>", dumpHTML(next));
        },

         function testSetHTML(next)
        {
            DOMAgent.setOuterHTML(htmlNode.id, "<html><head><!-- new head content --></head><body>Setting body as a part of HTML.</body></html>", dumpHTML(next));
        }
    ]);

    function dumpHTML(next)
    {
        function dump()
        {
            DOMAgent.getOuterHTML(htmlNode.id, callback);
            function callback(error, text)
            {
                InspectorTest.addResult(error ? error : 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>