<!DOCTYPE html>

<html>
<head>

</head>
<body>

<svg version="1.1" baseProfile="basic" xmlns="http://www.w3.org/2000/svg"
     xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 160 120">
    <defs><text id="text">Woohoo!</text></defs>
    <text><tref id="text-with-href" xlink:href="#text" /></text>
    <text><tref id="text-without-href" /></text>
</svg>

<p id="result">This test can only be run in DumpRenderTree.</p>

<script>
function log(string) {
    var result = document.getElementById('result');

    var div = document.createElement('div');
    div.appendChild(document.createTextNode(string));
    result.appendChild(div);
}

function runTest() {
    if (!window.internals || !window.testRunner)
         return;

    window.testRunner.dumpAsText();
    var result = document.getElementById('result');
    while (result.firstChild)
        result.removeChild(result.firstChild);

    var textWithHref = document.getElementById('text-with-href');
    var textWithoutHref = document.getElementById('text-without-href');

    var sr1 = internals.shadowRoot(textWithHref);
    if (sr1 == null) {
        log("FAIL: textWithHref should have a shadow root.");
        return;
    }
    var sr2 = internals.shadowRoot(textWithoutHref);
    if (sr2 == null) {
        log("FAIL: textWithoutHref should have a shadow root.");
        return;
    }

    log("SUCCESS!");
}

runTest();
</script>

</body>
</html>
