chromium/third_party/blink/web_tests/fast/xpath/4XPath/Borrowed/namespace-nodes.html

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<body>
<p>Tests that accessing XPath namespace axis doesn't cause a crash, see 
<a href="bug http://bugs.webkit.org/show_bug.cgi?id=12724">bug 12724</a>.</p>
<p>The actual results are incorrect, because XPath namespace nodes are not implemented yet.</p>

<div id="console"></div>

<script>
SRC_1 = '<?xml version="1.0" encoding="utf-8"?>\
<docu>\
<elem xmlns:unused="urn:uuu000"/>\
<elem xmlns="urn:sss111"/>\
<y:elem xmlns:y="urn:yyyy222"/>\
</docu>'

    if (window.testRunner)
        testRunner.dumpAsText();

    function shouldBe(actual, expected) {
        if (actual == expected)
            document.write("PASS: " + actual + " result nodes<br>");
        else
            document.write("FAILURE: " + actual + " result nodes (should be " + expected + ")<br>");
    }

    doc = (new DOMParser).parseFromString(SRC_1, "application/xml");

    EXPR = '//namespace::node()'
    nodeset = doc.evaluate(EXPR, doc, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);
    shouldBe(nodeset.snapshotLength, 7)

    EXPR = '//node()/namespace::node()'
    nodeset = doc.evaluate(EXPR, doc, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);
    shouldBe(nodeset.snapshotLength, 7)

    EXPR = '//*/namespace::node()'
    nodeset = doc.evaluate(EXPR, doc, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);
    shouldBe(nodeset.snapshotLength, 7)

    EXPR = '/*/*/namespace::node()'
    nodeset = doc.evaluate(EXPR, doc, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);
    shouldBe(nodeset.snapshotLength, 6)

    EXPR = '/*/namespace::node()|/*/*/namespace::node()'
    nodeset = doc.evaluate(EXPR, doc, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);
    shouldBe(nodeset.snapshotLength, 7)

    EXPR = '//*'
    nodeset = doc.evaluate(EXPR, doc, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);
    shouldBe(nodeset.snapshotLength, 4)

</script>
</body>
</html>