2012-04-12 19:58:10 +00:00
|
|
|
<html>
|
|
|
|
<head>
|
|
|
|
<script src=media-file.js></script>
|
|
|
|
<script src=video-test.js></script>
|
|
|
|
<script>
|
|
|
|
var state = 0;
|
|
|
|
var userGestureInitiated = 0;
|
|
|
|
|
2017-12-19 23:16:09 +00:00
|
|
|
if (window.internals) {
|
2016-03-10 21:35:10 +00:00
|
|
|
window.internals.settings.setVideoPlaybackRequiresUserGesture(true);
|
2017-12-19 23:16:09 +00:00
|
|
|
window.internals.settings.setRequiresUserGestureToLoadVideo(true);
|
|
|
|
}
|
2012-04-12 19:58:10 +00:00
|
|
|
|
|
|
|
function finishTest(success)
|
|
|
|
{
|
|
|
|
if (success)
|
|
|
|
endTest();
|
|
|
|
else
|
|
|
|
failTest("<b>Data loaded despite restriction.</b>");
|
|
|
|
}
|
|
|
|
|
|
|
|
function checkLoad()
|
|
|
|
{
|
|
|
|
consoleWrite("");
|
|
|
|
|
|
|
|
if (state == "load")
|
|
|
|
{
|
|
|
|
finishTest(true);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
state = "load";
|
2012-11-27 17:39:22 +00:00
|
|
|
consoleWrite("* Calling video.load() should not load any data.");
|
|
|
|
video.load();
|
2012-04-12 19:58:10 +00:00
|
|
|
setTimeout(checkLoad, 250);
|
|
|
|
}
|
|
|
|
|
|
|
|
function start()
|
|
|
|
{
|
|
|
|
findMediaElement();
|
|
|
|
waitForEvent('loadedmetadata', function() { finishTest(false) } );
|
|
|
|
|
|
|
|
state = "src";
|
|
|
|
consoleWrite("* Setting video.src, no data should load.");
|
|
|
|
video.src = findMediaFile("video", "content/test");
|
|
|
|
setTimeout(checkLoad, 250);
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
</head>
|
|
|
|
|
|
|
|
<body onload="start()">
|
|
|
|
<video controls preload=none></video>
|
|
|
|
<p>Test that video.load() should not cause media loading when user gesture is required.</p>
|
|
|
|
</body>
|
|
|
|
</html>
|