blob: 917dee651379192406b7849a9a89098c19125c37 [file] [log] [blame]
<html>
<head>
<script src=../../media-resources/video-test.js></script>
<script src=../../media-resources/media-file.js></script>
<script>
var counter = 0;
var frame;
function videoTest()
{
var video = frame.contentDocument.getElementsByTagName('video')[0];
if (video.error) {
failTest("video failed to load, referer was incorrect.");
return;
}
if (video.readyState >= HTMLMediaElement.HAVE_METADATA) {
logResult(true, "video loaded, referer was correct!");
endTest();
return;
}
if (++counter >= 100) {
failTest("TIMEOUT: video failed to load without an error.");
return;
}
setTimeout(videoTest, 100);
}
function loadMediaDocument()
{
var movie = findMediaFile('video', 'test');
var type = mimeTypeForExtension(movie.split('.').pop());
frame = document.createElement('iframe');
frame.width = "100%";
frame.height = "100%";
frame.onload = videoTest;
frame.src = 'http://127.0.0.1:8000/media/resources/video-referer-check-referer.py?referer=media-document-referer.html&name=' + movie + '&type=' + type;
document.body.appendChild(frame);
}
</script>
</head>
<body onload="loadMediaDocument()">
Tests that a media document has correct referer header.<br/>
</body>
</html>