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

Unified Diff: third_party/WebKit/LayoutTests/media/controls/controls-video-keynav-no-controls.html

Issue 2700663002: Adds keyboard functionality for videos. (Closed)
Patch Set: Forgot the test. Created 3 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/LayoutTests/media/controls/controls-video-keynav-no-controls.html
diff --git a/third_party/WebKit/LayoutTests/media/controls/controls-video-keynav-no-controls.html b/third_party/WebKit/LayoutTests/media/controls/controls-video-keynav-no-controls.html
new file mode 100644
index 0000000000000000000000000000000000000000..2f6810067f655932e6a1949533fec00468422a74
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/media/controls/controls-video-keynav-no-controls.html
@@ -0,0 +1,51 @@
+<DOCTYPE html>
+<title>Test media controls video keyboard navigation</title>
+<script src="../../resources/testharness.js"></script>
+<script src="../../resources/testharnessreport.js"></script>
+<script src="../media-file.js"></script>
+<script src="../media-controls.js"></script>
+<video></video>
+<script>
+test(_ => {
+ assert_true('eventSender' in window);
+}, 'eventSender required');
+
+async_test(function(t) {
+ var video = document.querySelector("video");
+ video.src = findMediaFile("video", "../content/test");
+ assert_equals(video.volume, 1);
+ assert_equals(video.currentTime, 0);
+
+ video.oncanplaythrough = t.step_func_done(function() {
+ // Focus the video.
+ video.focus();
+
+ // 'Enter' does not play the video.
+ eventSender.keyDown("Enter");
+ assert_true(video.paused);
+
+ // 'Down' does not reduces volume.
+ eventSender.keyDown("ArrowDown");
+ assert_equals(video.volume, 0);
+
+ // 'Up' does not increases volume.
+ eventSender.keyDown("ArrowUp");
+ assert_equals(video.volume, 0);
+
+ // 'Space' also does not pauses/plays the video.
+ eventSender.keyDown(" ");
+ assert_true(video.paused);
+
+ var cur = video.currentTime;
+
+ // 'Right' does not scrub the timeline forward.
+ eventSender.keyDown("ArrowRight");
+ assert_equals(video.currentTime, cur);
+
+ // 'End' does not set the timeline to end.
+ eventSender.keyDown("End");
+ assert_equals(video.currentTime, cur);
+ });
+});
+</script>
+

Powered by Google App Engine
This is Rietveld 408576698