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

Unified Diff: chrome/test/data/chromeos/virtual_keyboard/typing_test.js

Issue 99923003: Adds unit tests for swipe flick. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@flickv2
Patch Set: Removed extra whitespace. Created 7 years 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 | chrome/test/data/chromeos/virtual_keyboard/virtual_keyboard_test_base.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/data/chromeos/virtual_keyboard/typing_test.js
diff --git a/chrome/test/data/chromeos/virtual_keyboard/typing_test.js b/chrome/test/data/chromeos/virtual_keyboard/typing_test.js
index 5fde4d007d29b46bfc65af0e033fb410ccfb2dea..da2834e416fa938066a0989f2b75580c807528a5 100644
--- a/chrome/test/data/chromeos/virtual_keyboard/typing_test.js
+++ b/chrome/test/data/chromeos/virtual_keyboard/typing_test.js
@@ -305,3 +305,54 @@ function testFingerOutType(testDoneCallback) {
};
onKeyboardReady('testFingerOutType', runTest, testDoneCallback);
}
+
+/**
+ * Tests that flicking upwards on a key with hintText types the hint text.
+ * @param {Function} testDoneCallback The callback function on completion.
+ */
+function testSwipeFlick(testDoneCallback) {
+ var mockEvent = function(x, y, target) {
+ return {
+ pointerId: 1,
+ isPrimary: true,
+ screenX: x,
+ screenY: y,
+ target: target
+ };
+ }
+ var runTest = function() {
+ var key = findKey('.');
+ var send = chrome.virtualKeyboardPrivate.sendKeyEvent;
+ // Test flick on the '.', expect '?' to appear.
+ send.addExpectation({
+ type: 'keydown',
+ charValue: '?'.charCodeAt(0),
+ keyCode: 0xBF,
+ modifiers: Modifier.SHIFT
+ });
+ send.addExpectation({
+ type: 'keyup',
+ charValue: '?'.charCodeAt(0),
+ keyCode: 0xBF,
+ modifiers: Modifier.SHIFT
+ });
+ var height = key.clientHeight;
+ $('keyboard').updateSwipeTracker(mockEvent(0, -height/2, key));
kevers 2013/12/02 21:04:36 Can you use a pointer down and move in place of a
rsadam 2013/12/03 15:56:33 Done.
+ $('keyboard').up(mockEvent(0, -height, key));
+
+ // Test long flick. Should not have any output.
+ $('keyboard').updateSwipeTracker(mockEvent(0, -height/2, key));
+ $('keyboard').updateSwipeTracker(mockEvent(0, -2*height, key));
+ $('keyboard').up(mockEvent(0, -2*height, key));
+
+ // Test composed swipe and flick. Should not have any output.
+ var move = chrome.virtualKeyboardPrivate.moveCursor;
+ move.addExpectation(SwipeDirection.RIGHT,
+ Modifier.CONTROL & Modifier.SHIFT);
+ var width = key.clientWidth;
+ $('keyboard').updateSwipeTracker(mockEvent(0, -height/2, key));
+ $('keyboard').updateSwipeTracker(mockEvent(width, -height/2, key));
+ $('keyboard').up(mockEvent(width, -height/2, key));
+ };
+ onKeyboardReady('testSwipeFlick', runTest, testDoneCallback);
+}
« no previous file with comments | « no previous file | chrome/test/data/chromeos/virtual_keyboard/virtual_keyboard_test_base.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698