<html>
<head>
<script>
if (window.testRunner) {
    testRunner.dumpAsText();
    testRunner.dumpChildFramesAsText();
    testRunner.setHandlesAuthenticationChallenges(true);
    testRunner.setAuthenticationUsername("first");
    testRunner.setAuthenticationPassword("first-pw");
    testRunner.waitUntilDone();
}

function firstFrameLoaded()
{
    if (window.testRunner) {
        testRunner.setAuthenticationUsername("second");
        testRunner.setAuthenticationPassword("second-pw");
        testRunner.removeAllSessionCredentials(removedCredentialsCallback);
    }
}

function removedCredentialsCallback()
{
    var frame = document.createElement("iframe");
    frame.setAttribute("src", "http://127.0.0.1:8000/loading/resources/protected-resource.py");
    frame.setAttribute("onload", "secondFrameLoaded()");
    document.body.appendChild(frame);
}

function secondFrameLoaded()
{
    if (window.testRunner)
        testRunner.notifyDone();
}

</script>
</head>
<body>
This test verifies that we are able to remove credentials, by checking that we get an authenticaton.<br>
challenge for a path we normally would not get a challenge for, after having removed all credentials.<br>
The first frame's path is /loading/resources/protected-resource.py, and we should get a challenge for it.<br>
It will be authorized with first/first-pw.<br>
The second frame's path is identical to the first frame, and we should get a challenge for it, because credentials have been deleted.<br>
It will be authorized with second/second-pw.<br>
<iframe src="resources/protected-resource.py" onload="firstFrameLoaded();"></iframe>
</body>
</html>
