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

Side by Side 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2013 The Chromium Authors. All rights reserved. 2 * Copyright 2013 The Chromium Authors. All rights reserved.
3 * Use of this source code is governed by a BSD-style license that can be 3 * Use of this source code is governed by a BSD-style license that can be
4 * found in the LICENSE file. 4 * found in the LICENSE file.
5 */ 5 */
6 6
7 /** 7 /**
8 * Tester for lonpress typing accents. 8 * Tester for lonpress typing accents.
9 */ 9 */
10 function LongPressTypingTester(layout) { 10 function LongPressTypingTester(layout) {
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after
298 charValue: unicodeValue, 298 charValue: unicodeValue,
299 keyCode: 0x41, 299 keyCode: 0x41,
300 modifiers: Modifier.NONE 300 modifiers: Modifier.NONE
301 }); 301 });
302 key.down(mockEvent); 302 key.down(mockEvent);
303 key.out(mockEvent); 303 key.out(mockEvent);
304 mockTypeCharacter('s', 0x53, Modifier.NONE); 304 mockTypeCharacter('s', 0x53, Modifier.NONE);
305 }; 305 };
306 onKeyboardReady('testFingerOutType', runTest, testDoneCallback); 306 onKeyboardReady('testFingerOutType', runTest, testDoneCallback);
307 } 307 }
308
309 /**
310 * Tests that flicking upwards on a key with hintText types the hint text.
311 * @param {Function} testDoneCallback The callback function on completion.
312 */
313 function testSwipeFlick(testDoneCallback) {
314 var mockEvent = function(x, y, target) {
315 return {
316 pointerId: 1,
317 isPrimary: true,
318 screenX: x,
319 screenY: y,
320 target: target
321 };
322 }
323 var runTest = function() {
324 var key = findKey('.');
325 var send = chrome.virtualKeyboardPrivate.sendKeyEvent;
326 // Test flick on the '.', expect '?' to appear.
327 send.addExpectation({
328 type: 'keydown',
329 charValue: '?'.charCodeAt(0),
330 keyCode: 0xBF,
331 modifiers: Modifier.SHIFT
332 });
333 send.addExpectation({
334 type: 'keyup',
335 charValue: '?'.charCodeAt(0),
336 keyCode: 0xBF,
337 modifiers: Modifier.SHIFT
338 });
339 var height = key.clientHeight;
340 $('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.
341 $('keyboard').up(mockEvent(0, -height, key));
342
343 // Test long flick. Should not have any output.
344 $('keyboard').updateSwipeTracker(mockEvent(0, -height/2, key));
345 $('keyboard').updateSwipeTracker(mockEvent(0, -2*height, key));
346 $('keyboard').up(mockEvent(0, -2*height, key));
347
348 // Test composed swipe and flick. Should not have any output.
349 var move = chrome.virtualKeyboardPrivate.moveCursor;
350 move.addExpectation(SwipeDirection.RIGHT,
351 Modifier.CONTROL & Modifier.SHIFT);
352 var width = key.clientWidth;
353 $('keyboard').updateSwipeTracker(mockEvent(0, -height/2, key));
354 $('keyboard').updateSwipeTracker(mockEvent(width, -height/2, key));
355 $('keyboard').up(mockEvent(width, -height/2, key));
356 };
357 onKeyboardReady('testSwipeFlick', runTest, testDoneCallback);
358 }
OLDNEW
« 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