blob: 728acab9219d7a0c8bdaf6fadc1d99c350152614 [file] [log] [blame]
<!DOCTYPE html><!-- webkit-test-runner [ allowCrossOriginSubresourcesToAskForCredentials=true ] -->
<html>
<head>
<script src=../../media-resources/video-test.js></script>
<script src=../../media-resources/media-file.js></script>
<script>
if (window.testRunner) {
testRunner.setHandlesAuthenticationChallenges(true);
testRunner.setAuthenticationUsername("username");
testRunner.setAuthenticationPassword("password");
}
var tests;
var media = findMediaFile('video', 'test');
var type = mimeTypeForExtension(media.split('.').pop());
function startTests()
{
findMediaElement();
waitForEventAndFail('error');
waitForEvent('canplay', runNextTest);
tests = [
testSameDomain,
testCrossDomain,
];
runNextTest();
}
function runNextTest()
{
var test = tests.shift();
if (test)
test();
else
endTest();
}
function testSameDomain()
{
consoleWrite('Testing same domain (127.0.0.1)');
video.src = 'http://127.0.0.1:8000/media/resources/video-auth.php?name=' + media + '&type=' + type;
video.load();
}
function testCrossDomain()
{
consoleWrite('Testing cross domain (localhost)');
video.src = 'http://localhost:8000/media/resources/video-auth.php?name=' + media + '&type=' + type;
video.load();
}
</script>
</head>
<body onload="startTests()">
<video></video>
<br>
Tests that the media player sends authorization credentials when requesting a media file.
</body>
</html>