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

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

Issue 2700663002: Adds keyboard functionality for videos. (Closed)
Patch Set: Addresses mlamouri's #22, adds tests. Created 3 years, 8 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
(Empty)
1 <DOCTYPE html>
2 <title>Test media controls video keyboard navigation</title>
mlamouri (slow - plz ping) 2017/04/13 14:28:21 Can you move this file to media/controls/ (so we h
CJ 2017/04/14 21:56:45 Done.
3 <script src="../resources/testharness.js"></script>
4 <script src="../resources/testharnessreport.js"></script>
5 <script src="media-file.js"></script>
6 <script src="media-controls.js"></script>
7 <video controls></video>
8 <script>
9 test(_ => {
10 assert_true('eventSender' in window);
11 }, 'eventSender required');
12
13 async_test(function(t) {
14 var video = document.querySelector("video");
15 video.src = findMediaFile("video", "content/test");
mlamouri (slow - plz ping) 2017/04/13 14:28:21 Note: when you move to media/controls/, you will h
CJ 2017/04/14 21:56:45 Done.
16 assert_equals(video.volume, 1);
17 assert_equals(video.currentTime, 0);
18
19 video.oncanplaythrough = t.step_func_done(function() {
20
mlamouri (slow - plz ping) 2017/04/13 14:28:21 style: drop the empty line
CJ 2017/04/14 21:56:45 Done.
21 // Focus the video.
22 video.focus();
23
24 // 'Enter' plays the video.
25 eventSender.keyDown("Enter");
26 assert_false(video.paused);
27
28 // 'Down' reduces volume.
29 eventSender.keyDown("ArrowDown");
30 assert_less_than(video.volume, 1);
31
32 // 'Up' increases volume.
33 eventSender.keyDown("ArrowUp");
34 assert_equals(video.volume, 1);
35
36 // 'Enter' again pauses the video.
37 eventSender.keyDown("Enter");
38 assert_true(video.paused);
39
40 // 'Space' also pauses/plays the video.
41 eventSender.keyDown(" ");
42 assert_false(video.paused);
43
44 eventSender.keyDown(" ");
45 assert_true(video.paused);
46
47 var cur = video.currentTime;
48
49 // 'Right' scrubs the timeline forward.
50 // Used to move the timeline off the first frame which is neccessary to
51 // test 'Home', otherwise 'Home' is a no-op.
52 eventSender.keyDown("ArrowRight");
53 assert_greater_than(video.currentTime, cur);
54
55 // 'Home' sets the timeline to 0.
56 eventSender.keyDown("Home");
57 assert_equals(video.currentTime, 0);
58
59 // 'End' sets the timeline to end.
60 eventSender.keyDown("End");
61 assert_equals(video.currentTime, video.duration);
62
63 // 'Left' scrubs the timeline back.
64 eventSender.keyDown("ArrowLeft");
65 assert_less_than(video.currentTime, video.duration);
66 });
67 });
68 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698