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

Unified Diff: third_party/WebKit/LayoutTests/fast/events/keyboard-scroll-use-count.html

Issue 2729923002: UMA metrics for counting different ways of scrolling by keyboard. (Closed)
Patch Set: histogram merge conflicts resolved. Created 3 years, 10 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/frame/UseCounter.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/LayoutTests/fast/events/keyboard-scroll-use-count.html
diff --git a/third_party/WebKit/LayoutTests/fast/events/keyboard-scroll-use-count.html b/third_party/WebKit/LayoutTests/fast/events/keyboard-scroll-use-count.html
new file mode 100644
index 0000000000000000000000000000000000000000..4484ddaba926e0fdeeb2c29d8174bd884a27a5b8
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/fast/events/keyboard-scroll-use-count.html
@@ -0,0 +1,71 @@
+<!DOCTYPE html>
+<style>
+#scrollable {
+ height: 800px;
+ width: 800px;
+ overflow: auto;
+}
+#content {
+ height: 4000px;
+ width: 800px;
+}
+</style>
+
+<script src="../../resources/testharness.js"></script>
+<script src="../../resources/testharnessreport.js"></script>
+<div id="scrollable">
+ <div id="content"> </div>
+</div>
+
+<script>
+// values are from enum Feature in UseCounter.h
+var ScrollByKeyboardArrowKeys = 1843;
+var ScrollByKeyboardPageUpDownKeys = 1844;
+var ScrollByKeyboardHomeEndKeys = 1845;
+var ScrollByKeyboardSpacebarKey = 1846;
+
+test(function() {
+ if (!window.eventSender)
+ return;
+
+ var rect = document.getElementById("scrollable").getBoundingClientRect();
+ var startX = (rect.left + rect.right) / 2;
+ var startY = (rect.top + rect.bottom) / 2;
+
+ // Make sure that scrollable will scroll.
+ eventSender.mouseMoveTo(startX, startY);
+ eventSender.mouseDown();
+ eventSender.mouseUp();
+
+ scrollByArrowKey();
+ scrollBySpaceKey();
+ scrollByPage();
+ scrollByEndKey();
+
+}, "Tests that scrolling by keyboard keys is recorded in UMA usecounter.");
+
+function scrollByArrowKey() {
+ eventSender.keyDown('ArrowDown');
+ assert_true(internals.isUseCounted(document, ScrollByKeyboardArrowKeys));
+}
+
+function scrollBySpaceKey() {
+ eventSender.keyDown(" ", []);
+ assert_true(internals.isUseCounted(document, ScrollByKeyboardSpacebarKey));
+}
+
+function scrollByPage() {
+ if (navigator.platform.indexOf('Mac') == 0) {
+ eventSender.keyDown('ArrowDown', ["altKey"]);
+ } else {
+ eventSender.keyDown('PageDown');
+ }
+ assert_true(internals.isUseCounted(document,
+ ScrollByKeyboardPageUpDownKeys));
+}
+
+function scrollByEndKey() {
+ eventSender.keyDown('End');
+ assert_true(internals.isUseCounted(document, ScrollByKeyboardHomeEndKeys));
+}
+</script>
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/frame/UseCounter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698