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

Side by Side Diff: ui/keyboard/resources/elements/kb-keyboard.html

Issue 99923003: Adds unit tests for swipe flick. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@flickv2
Patch Set: Improved the tests and added more coverage. 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
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 <polymer-element name="kb-keyboard" on-key-over="{{keyOver}}" 7 <polymer-element name="kb-keyboard" on-key-over="{{keyOver}}"
8 on-key-up="{{keyUp}}" on-key-down="{{keyDown}}" 8 on-key-up="{{keyUp}}" on-key-down="{{keyDown}}"
9 on-key-longpress="{{keyLongpress}}" on-pointerup="{{up}}" 9 on-key-longpress="{{keyLongpress}}" on-pointerup="{{up}}"
10 on-pointerdown="{{down}}" on-pointerout="{{out}}" 10 on-pointerdown="{{down}}" on-pointerout="{{out}}"
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after
344 if (toKeyset) { 344 if (toKeyset) {
345 this.keyset = toKeyset; 345 this.keyset = toKeyset;
346 this.activeKeyset.nextKeyset = detail.nextKeyset; 346 this.activeKeyset.nextKeyset = detail.nextKeyset;
347 return true; 347 return true;
348 } 348 }
349 return false; 349 return false;
350 }, 350 },
351 351
352 ready: function() { 352 ready: function() {
353 this.voiceInput_ = new VoiceInput(this); 353 this.voiceInput_ = new VoiceInput(this);
354 this.swipeHandler = this.updateSwipeTracker.bind(this); 354 this.swipeHandler = this.move.bind(this);
355 }, 355 },
356 356
357 /** 357 /**
358 * Registers a callback for state change events. Lazy initializes a 358 * Registers a callback for state change events. Lazy initializes a
359 * mutation observer used to detect when the keyset selection is changed. 359 * mutation observer used to detect when the keyset selection is changed.
360 * @param{!Function} callback Callback function to register. 360 * @param{!Function} callback Callback function to register.
361 */ 361 */
362 addKeysetChangedObserver: function(callback) { 362 addKeysetChangedObserver: function(callback) {
363 if (!this.keysetChangedObserver) { 363 if (!this.keysetChangedObserver) {
364 var target = this.$.content; 364 var target = this.$.content;
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
465 this.keyTyped(detail); 465 this.keyTyped(detail);
466 return; 466 return;
467 } 467 }
468 }, 468 },
469 469
470 /** 470 /**
471 * This function is bound to swipeHandler. Updates the current swipe 471 * This function is bound to swipeHandler. Updates the current swipe
472 * status so that PointerEvents can be converted to Swipe events. 472 * status so that PointerEvents can be converted to Swipe events.
473 * @param {PointerEvent} event. 473 * @param {PointerEvent} event.
474 */ 474 */
475 updateSwipeTracker: function(event) { 475 move: function(event) {
476 if (!swipeTracker.update(event)) 476 if (!swipeTracker.update(event))
477 return; 477 return;
478 // Conversion was successful, swipe is now in progress. 478 // Conversion was successful, swipe is now in progress.
479 swipeInProgress = true; 479 swipeInProgress = true;
480 if (this.lastPressedKey) { 480 if (this.lastPressedKey) {
481 this.lastPressedKey.classList.remove('active'); 481 this.lastPressedKey.classList.remove('active');
482 this.lastPressedKey = null; 482 this.lastPressedKey = null;
483 } 483 }
484 this.onSwipeUpdate(swipeTracker.populateDetails(false)); 484 this.onSwipeUpdate(swipeTracker.populateDetails(false));
485 }, 485 },
(...skipping 494 matching lines...) Expand 10 before | Expand all | Expand 10 after
980 } 980 }
981 } 981 }
982 } 982 }
983 if (keysetsLoaded) 983 if (keysetsLoaded)
984 console.error('No default keyset found for ' + this.layout); 984 console.error('No default keyset found for ' + this.layout);
985 return false; 985 return false;
986 } 986 }
987 }); 987 });
988 </script> 988 </script>
989 </polymer-element> 989 </polymer-element>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698