blob: 4d1f56637f20e1ec18b5219a7763a350e1bafff3 [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;
function runTest()
{
session = new MediaSession("content");
findMediaElement();
waitForEvent('canplaythrough', beginPlaying);
video.src = findMediaFile("video", "../content/counting");
video.session = session;
waitForEvent('playing', beganPlaying, false, true, video);
}
function beginPlaying(event)
{
if (window.internals)
testExpected('internals.mediaSessionCurrentState(session)', "idle");
consoleWrite("Idle Media Sessions should not respond to Play/Pause events.");
testExpected('video.paused', true);
if (window.internals) {
consoleWrite("Sending Play/Pause media event.");
run('internals.sendMediaControlEvent("play-pause")');
testExpected('video.paused', true);
}
consoleWrite("");
consoleWrite("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 Play/Pause media event.");
run('internals.sendMediaControlEvent("play-pause")');
testExpected('video.paused', true);
}
endTest();
}
</script>
</head>
<body onload="runTest()">
<p>'Content' sessions that are active should respond to Play/Pause media control events.</p>
<video id="video" />
</body>
</html>