Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(459)

Side by Side Diff: third_party/WebKit/LayoutTests/media/controls-volume-slider-keynav.html

Issue 2021693002: Convert controls-* tests to testharness.js (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address nits Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 <!doctype html> 1 <!DOCTYPE html>
2 <html> 2 <title>Test media controls volume slider keyboard navigation</title>
3 <head> 3 <script src="../resources/testharness.js"></script>
4 <title>media controls volume slider keyboard navigation</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 // Focus the volume slider.
20 var button = mediaControlsButton(audio, "volume-slider");
21 button.focus();
22 13
23 // 'Left' reduces volume. 14 audio.onloadedmetadata = t.step_func(function() {
24 eventSender.keyDown('leftArrow'); 15 // Focus the volume slider.
25 testExpected("audio.volume", 1, '<'); 16 mediaControlsButton(audio, "volume-slider").focus();
26 17
27 // 'Right' reduces volume (same step as 'Left', but opposite sig n). 18 // 'Left' reduces volume.
28 eventSender.keyDown('rightArrow'); 19 eventSender.keyDown("leftArrow");
29 testExpected("audio.volume", 1); 20 assert_less_than(audio.volume, 1);
30 21
31 // 'Home' sets minimum volume (0). 22 // 'Right' increases volume (same step as 'Left', but opposite sign).
32 eventSender.keyDown('home'); 23 eventSender.keyDown("rightArrow");
33 testExpected("audio.volume", 0); 24 assert_equals(audio.volume, 1);
34 25
35 // 'End' sets maximum volume (1). 26 // 'Home' sets minimum volume (0).
36 eventSender.keyDown('end'); 27 eventSender.keyDown("home");
37 testExpected("audio.volume", 1); 28 assert_equals(audio.volume, 0);
38 29
39 waitForEventAndEnd("volumechange"); 30 // 'End' sets maximum volume (1).
40 }); 31 eventSender.keyDown("end");
41 </script> 32 assert_equals(audio.volume, 1);
42 </body> 33
43 </html> 34 audio.onvolumechange = t.step_func_done();
35 });
36 });
37 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698