<!DOCTYPE html>
<title>Test "volume" attribute.</title>
<script src="../resources/testharness.js"></script>
<script src="../resources/testharnessreport.js"></script>
<video></video>
<script>
async_test(function(t) {
var video = document.querySelector("video");
assert_equals(video.volume, 1.0);
video.volume = 0.5;
assert_equals(video.volume, 0.5);
video.volume = Number.MIN_VALUE;
assert_equals(video.volume, Number.MIN_VALUE);
video.volume = 0;
assert_equals(video.volume, 0);
assert_throws_dom("IndexSizeError", function() { video.volume = 1.5; });
assert_throws_dom("IndexSizeError", function() { video.volume = -0.5; });
assert_throws_js(TypeError, function() { video.volume = -Infinity; });
assert_throws_js(TypeError, function() { video.volume = Infinity; });
assert_throws_js(TypeError, function() { video.volume = NaN; });
video.oncanplaythrough = t.step_func_done(function() {
assert_equals(video.volume, 0);
video.volume = 0.5;
assert_equals(video.volume, 0.5);
assert_throws_dom("IndexSizeError", function() { video.volume = 1.5; });
assert_throws_dom("IndexSizeError", function() { video.volume = -0.5; });
});
video.src = "content/test.ogv";
});
</script>