| OLD | NEW |
| 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 27 matching lines...) Expand all Loading... |
| 38 }; | 38 }; |
| 39 | 39 |
| 40 /** | 40 /** |
| 41 * Mock port that supports the {@code onMessage} and {@code onDisconnect} | 41 * Mock port that supports the {@code onMessage} and {@code onDisconnect} |
| 42 * events as well as {@code postMessage}. | 42 * events as well as {@code postMessage}. |
| 43 * @constructor. | 43 * @constructor. |
| 44 */ | 44 */ |
| 45 function MockPort() { | 45 function MockPort() { |
| 46 this.onMessage = new MockEvent(); | 46 this.onMessage = new MockEvent(); |
| 47 this.onDisconnect = new MockEvent(); | 47 this.onDisconnect = new MockEvent(); |
| 48 /** @type {Array.<Object>} */ | 48 /** @type {Array<Object>} */ |
| 49 this.messages = []; | 49 this.messages = []; |
| 50 } | 50 } |
| 51 | 51 |
| 52 MockPort.prototype = { | 52 MockPort.prototype = { |
| 53 /** | 53 /** |
| 54 * Stores {@code message} in this object. | 54 * Stores {@code message} in this object. |
| 55 * @param {Object} message Message to store. | 55 * @param {Object} message Message to store. |
| 56 */ | 56 */ |
| 57 postMessage: function(message) { | 57 postMessage: function(message) { |
| 58 this.messages.push(message); | 58 this.messages.push(message); |
| (...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 302 sendSetUncommitted(' there!'); | 302 sendSetUncommitted(' there!'); |
| 303 sendCommitUncommitted(CONTEXT_ID + 1); | 303 sendCommitUncommitted(CONTEXT_ID + 1); |
| 304 assertEquals('Hello', text); | 304 assertEquals('Hello', text); |
| 305 | 305 |
| 306 sendSetUncommitted(' you!'); | 306 sendSetUncommitted(' you!'); |
| 307 assertFalse(this.sendKeyDown('KeyY')); | 307 assertFalse(this.sendKeyDown('KeyY')); |
| 308 assertEquals('Hello you!', text); | 308 assertEquals('Hello you!', text); |
| 309 assertFalse(this.sendKeyUp('KeyY')); | 309 assertFalse(this.sendKeyUp('KeyY')); |
| 310 assertEquals('Hello you!', text); | 310 assertEquals('Hello you!', text); |
| 311 }); | 311 }); |
| OLD | NEW |