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

Unified Diff: chrome/browser/resources/chromeos/braille_ime/braille_ime_unittest.gtestjs

Issue 1039703002: Make contracted braille input work in more contexts. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@docs2
Patch Set: Rebase Created 5 years, 7 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
Index: chrome/browser/resources/chromeos/braille_ime/braille_ime_unittest.gtestjs
diff --git a/chrome/browser/resources/chromeos/braille_ime/braille_ime_unittest.gtestjs b/chrome/browser/resources/chromeos/braille_ime/braille_ime_unittest.gtestjs
index 83740b6c5c9f5e8afe116187ccb2efbfffe966e0..a1e641b0b080320a74f3e8f3557d841852d2ca65 100644
--- a/chrome/browser/resources/chromeos/braille_ime/braille_ime_unittest.gtestjs
+++ b/chrome/browser/resources/chromeos/braille_ime/braille_ime_unittest.gtestjs
@@ -276,3 +276,36 @@ TEST_F('BrailleImeUnitTest', 'ReplaceText', function() {
assertFalse(hasSelection);
assertEquals('Hi, good bye!', text);
});
+
+TEST_F('BrailleImeUnitTest', 'Uncommitted', function() {
+ var CONTEXT_ID = 1;
+ var text = '';
+ chrome.input.ime.commitText = function(params) {
+ assertEquals(CONTEXT_ID, params.contextID);
+ text += params.text;
+ };
+ var sendSetUncommitted = function(text) {
+ this.port.onMessage.dispatch(
+ {type: 'setUncommitted', contextID: CONTEXT_ID, text: text});
+ }.bind(this);
+ var sendCommitUncommitted = function(contextID) {
+ this.port.onMessage.dispatch(
+ {type: 'commitUncommitted', contextID: contextID});
+ }.bind(this);
+
+ this.activateIme();
+ sendSetUncommitted('Hi');
+ assertEquals('', text);
+ sendSetUncommitted('Hello');
+ sendCommitUncommitted(CONTEXT_ID);
+ assertEquals('Hello', text);
+ sendSetUncommitted(' there!');
+ sendCommitUncommitted(CONTEXT_ID + 1);
+ assertEquals('Hello', text);
+
+ sendSetUncommitted(' you!');
+ assertFalse(this.sendKeyDown('KeyY'));
+ assertEquals('Hello you!', text);
+ assertFalse(this.sendKeyUp('KeyY'));
+ assertEquals('Hello you!', text);
+});

Powered by Google App Engine
This is Rietveld 408576698