<!DOCTYPE html>
<html>
<head>
<script src="resources/utilities.js"></script>
<script>
if (window.testRunner && window.internals) {
    testRunner.dumpAsText();
    internals.settings.setHyperlinkAuditingEnabled(true);
    testRunner.waitUntilDone();
}

function test()
{
    clickElement(document.getElementById("a"));
}

function checkPing()
{
    function actualCheckPing()
    {
        window.location = "../resources/check-ping.py";
    }
    // We assume that if redirects were followed when saving a ping that they will complete within one second.
    // FIXME: Is there are better way to test that a redirect occurred?
    window.setTimeout(actualCheckPing, 1000);
}

window.onload = function ()
{
    clearLastPingResultAndRunTest(test);
}
</script>
</head>
<body>
<p>This test PASSED if the filename of the REQUEST_URI in the dumped report is save-ping.py. Otherwise, it FAIL.</p>
<a id="a" href="javascript:checkPing()" ping="../resources/save-ping-and-redirect-to-save-ping.py">Navigate and send ping</a>
</body>
</html>
