REGRESSION (r170808): Volume slider in built-in media controls only changes volume...
[WebKit-https.git] / LayoutTests / media / video-volume-slider-drag.html
1 <html>
2 <head>
3     <title>Test that dragging the volume slider results in multiple volume change events.</title>
4     <script src="media-file.js"></script>
5     <script src="media-controls.js"></script>
6     <script src="video-test.js"></script>
7     <script>
8         var video;
9         var expectedVolumeChangeCount = 4;
10         var volumeChangeCount = 0;
11
12         function init()
13         {
14             if (window.internals)
15                 internals.suspendAnimations();
16
17             findMediaElement();
18
19             waitForEvent('canplaythrough', startTest);
20             waitForEvent('volumechange', volumeChange);
21             video.src = findMediaFile('video', 'content/test');
22         }
23
24         function startTest()
25         {
26             if (!window.eventSender)
27                 return;
28
29             muteCoords = mediaControlsButtonCoordinates(video, 'mute-button');
30             eventSender.mouseMoveTo(muteCoords[0], muteCoords[1]);
31             setTimeout(move, 100);
32         }
33
34         function move()
35         {
36             if (!window.eventSender)
37                 return;
38
39             volumeCoords = mediaControlsButtonCoordinates(video, 'volume-slider');
40             eventSender.mouseMoveTo(volumeCoords[0], volumeCoords[1]);
41             eventSender.mouseDown();
42             for (var i = 10; i < 80; i += 5)
43             eventSender.mouseMoveTo(volumeCoords[0], volumeCoords[1] - i);
44             eventSender.mouseUp();
45
46             failTestIn(1000);
47         }
48
49         function volumeChange()
50         {
51             if (++volumeChangeCount === expectedVolumeChangeCount)
52                 endTest();
53         }
54     </script>
55 </head>
56 <body onload="init()">
57     <video controls></video>
58 </body>
59 </html>