chromium/third_party/blink/web_tests/fast/dom/Document/title-property-set-multiple-times.html

<html>
<head>
<script>
function log(message)
{
    var paragraph = document.createElement("p");
    paragraph.appendChild(document.createTextNode(message));
    document.getElementById("console").appendChild(paragraph);
}

function expect(expected, actual)
{
    var msg = "Expected " + expected + ", got " + actual + ": ";
    if (expected == actual)
        log(msg + "PASS");
    else
        log(msg + "FAIL");
}

function createTitleElement(title)
{
    var t = document.createElement('title');
    t.appendChild(document.createTextNode(title));
    return t;
}

function test()
{
    if (window.testRunner)
        testRunner.dumpAsText();

    var head = document.getElementsByTagName('head')[0];

    expect('', document.title);
    head.appendChild(createTitleElement('First title'));
    expect('First title', document.title);
    document.title = 'Second title';
    expect('Second title', document.title);
    head.appendChild(createTitleElement('Third title'));
    expect('Second title', document.title);
    document.title = 'Fourth title';
    expect('Fourth title', document.title);

    var titles = head.getElementsByTagName('title');
    var expectedTitles = {1: 'Third title', 0: ''};
    while (titles.length) {
        titles[0].parentNode.removeChild(titles[0]);
        expect(expectedTitles[titles.length], document.title);
    }

    head.appendChild(createTitleElement('Fifth title'));
    expect('Fifth title', document.title);
}
</script>
</head>
<body>
<p>Test for <a href='http://bugs.webkit.org/show_bug.cgi?id=11692'>http://bugs.webkit.org/show_bug.cgi?id=11692</a>.
   If the title has been explicitly set via document.title, any further &lt;title&gt; tags parsed should not effect
   the document title.</p>
<hr>
<div id='console'/>
<script>
    test();
</script>
</body>
</html>