blob: 3d69088c5c8c212f50b6415932ee9d95dda807b1 [file] [log] [blame]
<!DOCTYPE html>
<html>
<head>
<!-- This is a test for https://bugs.webkit.org/show_bug.cgi?id=197650 -->
<title>Certificate validation and basic authentication</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<script>
function with_iframe(url) {
return new Promise(function(resolve) {
var frame = document.createElement('iframe');
frame.className = 'test-iframe';
frame.src = url;
frame.onload = function() { resolve(frame); };
document.body.appendChild(frame);
});
}
async function doTest()
{
assert_true(!!window.testRunner, "Test requires testRunner");
window.testRunner.setAllowsAnySSLCertificate(true);
window.testRunner.setHandlesAuthenticationChallenges(true);
window.testRunner.setAuthenticationUsername("user");
window.testRunner.setAuthenticationPassword("");
const currentCallbackCounts = window.testRunner.serverTrustEvaluationCallbackCallsCount;
const iframe = await with_iframe("https://localhost:8443/resources/basic-auth.php?uid=user");
iframe.remove();
assert_equals(window.testRunner.serverTrustEvaluationCallbackCallsCount - currentCallbackCounts, 1);
}
doTest().then(done, (e) => { assert_unreached("test failed: " + e); done(); });
</script>
</body>
</html>