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); |
+} |