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

Side by Side 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 /** 5 /**
6 * @fileoverview Unit test for the Braille IME. 6 * @fileoverview Unit test for the Braille IME.
7 */ 7 */
8 8
9 /** 9 /**
10 * Mock Chrome event supporting one listener. 10 * Mock Chrome event supporting one listener.
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after
269 deleteBefore: deleteBefore, newText: newText}); 269 deleteBefore: deleteBefore, newText: newText});
270 }.bind(this); 270 }.bind(this);
271 this.activateIme(); 271 this.activateIme();
272 sendReplaceText(0, 'hello!'); 272 sendReplaceText(0, 'hello!');
273 assertEquals('Hi, hello!', text); 273 assertEquals('Hi, hello!', text);
274 hasSelection = true; 274 hasSelection = true;
275 sendReplaceText('hello!'.length, 'good bye!'); 275 sendReplaceText('hello!'.length, 'good bye!');
276 assertFalse(hasSelection); 276 assertFalse(hasSelection);
277 assertEquals('Hi, good bye!', text); 277 assertEquals('Hi, good bye!', text);
278 }); 278 });
279
280 TEST_F('BrailleImeUnitTest', 'Uncommitted', function() {
281 var CONTEXT_ID = 1;
282 var text = '';
283 chrome.input.ime.commitText = function(params) {
284 assertEquals(CONTEXT_ID, params.contextID);
285 text += params.text;
286 };
287 var sendSetUncommitted = function(text) {
288 this.port.onMessage.dispatch(
289 {type: 'setUncommitted', contextID: CONTEXT_ID, text: text});
290 }.bind(this);
291 var sendCommitUncommitted = function(contextID) {
292 this.port.onMessage.dispatch(
293 {type: 'commitUncommitted', contextID: contextID});
294 }.bind(this);
295
296 this.activateIme();
297 sendSetUncommitted('Hi');
298 assertEquals('', text);
299 sendSetUncommitted('Hello');
300 sendCommitUncommitted(CONTEXT_ID);
301 assertEquals('Hello', text);
302 sendSetUncommitted(' there!');
303 sendCommitUncommitted(CONTEXT_ID + 1);
304 assertEquals('Hello', text);
305
306 sendSetUncommitted(' you!');
307 assertFalse(this.sendKeyDown('KeyY'));
308 assertEquals('Hello you!', text);
309 assertFalse(this.sendKeyUp('KeyY'));
310 assertEquals('Hello you!', text);
311 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698