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
3 // found in the LICENSE file.
5 // Include test fixture.
6 GEN_INCLUDE(['../testing/chromevox_unittest_base.js']);
9 * @extends {cvox.BrailleInterface}
12 function FakeBraille() {
15 FakeBraille.prototype = {
17 write: function(content) {
18 this.content = content;
23 function FakeNavigationManager() {
26 FakeNavigationManager.prototype = {
27 getBraille: function() {
28 return this.navBraille;
31 setNavBraille: function(navBraille) {
32 this.navBraille = navBraille;
40 * @extends {ChromeVoxUnitTestBase}
42 function CvoxBrailleTextHandlerUnitTest() {}
44 CvoxBrailleTextHandlerUnitTest.prototype = {
45 __proto__: ChromeVoxUnitTestBase.prototype,
49 'cvox.BrailleInterface',
50 'cvox.BrailleTextHandler',
52 'cvox.NavigationManager',
57 this.navigationManager = new FakeNavigationManager();
58 this.braille = new FakeBraille();
59 cvox.ChromeVox.navigationManager = this.navigationManager;
60 this.brailleTextHandler = new cvox.BrailleTextHandler(this.braille);
64 TEST_F('CvoxBrailleTextHandlerUnitTest', 'UpdateByUser', function() {
65 var navBraille = new cvox.NavBraille({ text: 'Hello, world!' });
66 this.navigationManager.setNavBraille(navBraille);
68 this.brailleTextHandler.changed('', 0, 0, false);
69 assertEquals(navBraille, this.braille.content);