OLD | NEW |
1 <!doctype html> | 1 <!DOCTYPE html> |
2 <html> | 2 <title>media controls volume slider</title> |
3 <head> | 3 <script src="../resources/testharness.js"></script> |
4 <title>media controls volume slider</title> | 4 <script src="../resources/testharnessreport.js"></script> |
5 <script src="media-file.js"></script> | 5 <script src="media-file.js"></script> |
6 <script src="media-controls.js"></script> | 6 <script src="media-controls.js"></script> |
7 <!-- TODO(foolip): Convert test to testharness.js. crbug.com/588956 | 7 <audio controls></audio> |
8 (Please avoid writing new tests using video-test.js) --> | 8 <script> |
9 <script src="video-test.js"></script> | 9 async_test(function(t) { |
10 </head> | 10 var audio = document.querySelector("audio"); |
11 <body> | 11 audio.src = findMediaFile("audio", "content/test"); |
12 <audio controls></audio> | 12 assert_equals(audio.volume, 1); |
13 <script> | |
14 findMediaElement(); | |
15 audio.src = findMediaFile("audio", "content/test"); | |
16 testExpected("audio.volume", 1); | |
17 waitForEvent("loadedmetadata", function() | |
18 { | |
19 // click the middle of the volume slider | |
20 var coords = mediaControlsButtonCoordinates(audio, "volume-slide
r"); | |
21 eventSender.mouseMoveTo(coords[0], coords[1]); | |
22 eventSender.mouseDown(); | |
23 eventSender.mouseMoveTo(coords[0]-1, coords[1]); | |
24 eventSender.mouseMoveTo(coords[0], coords[1]); | |
25 eventSender.mouseUp(); | |
26 | 13 |
27 testExpected("audio.volume", 0.4, '>'); | 14 audio.onloadedmetadata = t.step_func(function() { |
28 testExpected("audio.volume", 0.6, '<'); | 15 // click the middle of the volume slider |
29 waitForEventAndEnd("volumechange"); | 16 var coords = mediaControlsButtonCoordinates(audio, "volume-slider"); |
30 }); | 17 eventSender.mouseMoveTo(coords[0], coords[1]); |
31 </script> | 18 eventSender.mouseDown(); |
32 </body> | 19 eventSender.mouseMoveTo(coords[0]-1, coords[1]); |
33 </html> | 20 eventSender.mouseMoveTo(coords[0], coords[1]); |
| 21 eventSender.mouseUp(); |
| 22 |
| 23 assert_greater_than(audio.volume, 0.4); |
| 24 assert_less_than(audio.volume, 0.6); |
| 25 audio.onvolumechange = t.step_func_done(); |
| 26 }); |
| 27 }); |
| 28 </script> |
OLD | NEW |