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

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

Issue 2700663002: Adds keyboard functionality for videos. (Closed)
Patch Set: Now calls IsSpatialNavigationEnabled() directly. Created 3 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
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/media/controls/controls-video-keynav-no-controls.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 <DOCTYPE html>
2 <title>Test media controls video keyboard navigation</title>
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");
16 assert_equals(video.volume, 1);
17 assert_equals(video.currentTime, 0);
18
19 video.oncanplaythrough = t.step_func_done(function() {
20 // Focus the video.
21 video.focus();
22
23 // 'Enter' plays the video.
24 eventSender.keyDown("Enter");
25 assert_false(video.paused);
26
27 // 'Down' reduces volume.
28 eventSender.keyDown("ArrowDown");
29 assert_less_than(video.volume, 1);
30
31 // 'Up' increases volume.
32 eventSender.keyDown("ArrowUp");
33 assert_equals(video.volume, 1);
34
35 // 'Enter' again pauses the video.
36 eventSender.keyDown("Enter");
37 assert_true(video.paused);
38
39 // 'Space' also pauses/plays the video.
40 eventSender.keyDown(" ");
41 assert_false(video.paused);
42
43 eventSender.keyDown(" ");
44 assert_true(video.paused);
45
46 var cur = video.currentTime;
47
48 // 'Right' scrubs the timeline forward.
49 // Used to move the timeline off the first frame which is neccessary to
50 // test 'Home', otherwise 'Home' is a no-op.
51 eventSender.keyDown("ArrowRight");
52 assert_greater_than(video.currentTime, cur);
53
54 // 'Home' sets the timeline to 0.
55 eventSender.keyDown("Home");
56 assert_equals(video.currentTime, 0);
57
58 // 'End' sets the timeline to end.
59 eventSender.keyDown("End");
60 assert_equals(video.currentTime, video.duration);
61
62 // 'Left' scrubs the timeline back.
63 eventSender.keyDown("ArrowLeft");
64 assert_less_than(video.currentTime, video.duration);
65 });
66 });
67 </script>
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/media/controls/controls-video-keynav-no-controls.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698