blob: 783ed94406296670c8848d20deb8c7fd2b1a7d2e [file] [log] [blame]
<video controls></video>
<p>Test 'volume' attribute<p>
<script src=media-file.js></script>
<script src=video-test.js></script>
<script>
function compareWithTolerance(a, b) {
tolerance = 0.00001;
return (Math.abs(a - b) < tolerance);
}
testExpected("compareWithTolerance(video.volume, 1.0)", true);
run("video.volume = 0.5");
testExpected("compareWithTolerance(video.volume, 0.5)", true);
run("video.volume = 0");
testExpected("compareWithTolerance(video.volume, 0)", true);
testDOMException("video.volume = 1.5", "DOMException.INDEX_SIZE_ERR");
testDOMException("video.volume = -0.5", "DOMException.INDEX_SIZE_ERR");
video.src = findMediaFile("video", "content/test");
run("video.load()");
waitForEvent("canplaythrough", function () {
testExpected("compareWithTolerance(video.volume, 0)", true);
run("video.volume = 0.5");
testExpected("compareWithTolerance(video.volume, 0.5)", true);
testDOMException("video.volume = 1.5", "DOMException.INDEX_SIZE_ERR");
testDOMException("video.volume = -0.5", "DOMException.INDEX_SIZE_ERR");
endTest();
});
</script>