OLD | NEW |
1 <video controls></video> | 1 <!DOCTYPE html> |
2 <p>Test 'volume' attribute<p> | 2 <title>Test "volume" attribute.</title> |
3 <script src=media-file.js></script> | 3 <script src="../resources/testharness.js"></script> |
4 <!-- TODO(foolip): Convert test to testharness.js. crbug.com/588956 | 4 <script src="../resources/testharnessreport.js"></script> |
5 (Please avoid writing new tests using video-test.js) --> | 5 <script src="media-file.js"></script> |
6 <script src=video-test.js></script> | 6 <video></video> |
7 <script> | 7 <script> |
8 testExpected("video.volume", 1.0); | 8 async_test(function(t) { |
9 run("video.volume = 0.5"); | 9 var video = document.querySelector("video"); |
10 testExpected("video.volume", 0.5); | 10 assert_equals(video.volume, 1.0); |
11 run("video.volume = Number.MIN_VALUE"); | 11 video.volume = 0.5; |
12 testExpected("video.volume", Number.MIN_VALUE); | 12 assert_equals(video.volume, 0.5); |
13 run("video.volume = 0"); | 13 video.volume = Number.MIN_VALUE; |
14 testExpected("video.volume", 0); | 14 assert_equals(video.volume, Number.MIN_VALUE); |
15 testDOMException("video.volume = 1.5", "DOMException.INDEX_SIZE_ERR"); | 15 video.volume = 0; |
16 testDOMException("video.volume = -0.5", "DOMException.INDEX_SIZE_ERR"); | 16 assert_equals(video.volume, 0); |
17 testException("video.volume = -Infinity", '"TypeError: Failed to set the \'v
olume\' property on \'HTMLMediaElement\': The provided double value is non-finit
e."'); | 17 assert_throws("IndexSizeError", function() { video.volume = 1.5; }); |
18 testException("video.volume = Infinity", '"TypeError: Failed to set the \'vo
lume\' property on \'HTMLMediaElement\': The provided double value is non-finite
."'); | 18 assert_throws("IndexSizeError", function() { video.volume = -0.5; }); |
19 testException("video.volume = NaN", '"TypeError: Failed to set the \'volume\
' property on \'HTMLMediaElement\': The provided double value is non-finite."'); | 19 assert_throws(new TypeError, function() { video.volume = -Infinity; }); |
| 20 assert_throws(new TypeError, function() { video.volume = Infinity; }); |
| 21 assert_throws(new TypeError, function() { video.volume = NaN; }); |
| 22 |
| 23 video.oncanplaythrough = t.step_func_done(function() { |
| 24 assert_equals(video.volume, 0); |
| 25 video.volume = 0.5; |
| 26 assert_equals(video.volume, 0.5); |
| 27 assert_throws("IndexSizeError", function() { video.volume = 1.5; }); |
| 28 assert_throws("IndexSizeError", function() { video.volume = -0.5; }); |
| 29 }); |
| 30 |
20 video.src = findMediaFile("video", "content/test"); | 31 video.src = findMediaFile("video", "content/test"); |
21 run("video.load()"); | 32 }); |
22 waitForEvent("canplaythrough", function () { | 33 </script> |
23 testExpected("video.volume", 0); | |
24 run("video.volume = 0.5"); | |
25 testExpected("video.volume", 0.5); | |
26 testDOMException("video.volume = 1.5", "DOMException.INDEX_SIZE_ERR"); | |
27 testDOMException("video.volume = -0.5", "DOMException.INDEX_SIZE_ERR"); | |
28 endTest(); | |
29 }); | |
30 </script> | |
OLD | NEW |