blob: 4bebd8bd6bd31778110ae7a04a9867070620afe9 [file] [log] [blame]
<!DOCTYPE html>
<html>
<head>
<script src="../video-test.js"></script>
<script src="../media-file.js"></script>
<script type="text/javascript">
var session, controls;
function runTest()
{
session = new MediaSession("content");
controls = session.controls;
controls.nextTrackEnabled = false;
controls.previousTrackEnabled = false;
waitForEvent('nexttrack', skipToNextTrack, false, true, controls);
waitForEvent('previoustrack', skipToPreviousTrack, false, true, controls);
findMediaElement();
waitForEvent('canplaythrough', beginPlaying);
video.src = findMediaFile("video", "../content/counting");
video.session = session;
waitForEvent('playing', beganPlaying, false, true, video);
}
function beginPlaying(event)
{
testExpected('video.paused', true);
consoleWrite("Begin playing media.");
video.play();
}
function beganPlaying(event)
{
consoleWrite("Media began playing.");
testExpected('video.paused', false);
if (window.internals) {
testExpected('internals.mediaSessionCurrentState(session)', "active");
consoleWrite("Sending Next Track media event.");
run('internals.sendMediaControlEvent("next-track")');
consoleWrite("Sending Previous Track media event.");
run('internals.sendMediaControlEvent("previous-track")');
window.setTimeout("endTest()", 200);
} else {
endTest();
}
}
function skipToNextTrack(event)
{
failTest("next-track events should not be fired.");
}
function skipToPreviousTrack(event)
{
failTest("previous-track events should not be fired.");
}
</script>
</head>
<body onload="runTest()">
<p>Previous/Next Track events should not be fired if previous/nextTrackEnabled are 'false'.</p>
<video id="video" />
</body>
</html>