blob: 0d09675079c73e889e89b831d1d043a6c34a947e [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 runAllTests()
{
findMediaElement();
waitForEvent('canplaythrough', beginPlaying);
runTest("transient");
}
function runTest(sessionKind)
{
consoleWrite('---');
consoleWrite('Testing "' + sessionKind + '" session kind');
consoleWrite('---');
session = new MediaSession(sessionKind);
video.src = findMediaFile("video", "../content/counting");
video.session = session;
waitForEvent('playing', beganPlaying, false, true, video);
}
function beginPlaying(event)
{
video.play();
}
function beganPlaying(event)
{
consoleWrite("Media began playing.");
testExpected('video.paused', false);
if (window.internals) {
testExpected('internals.mediaSessionCurrentState(session)', "active");
consoleWrite("Non-Content Media Sessions should not respond to Play/Pause events.");
consoleWrite("Sending Play/Pause media event.");
run('internals.sendMediaControlEvent("play-pause")');
testExpected('video.paused', false);
}
if (video.session.kind == "transient")
runTest("transient-solo");
else if (video.session.kind == "transient-solo")
runTest("ambient");
else if (video.session.kind == "ambient")
endTest();
else
failTest("Unexpected session kind");
}
</script>
</head>
<body onload="runAllTests()">
<p>'Transient', 'Transient Solo', and 'Ambient' sessions should not respond to Play/Pause media control events.</p>
<video id="video" />
</body>
</html>