OLD | NEW |
| (Empty) |
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. | |
4 | |
5 // Include test fixture. | |
6 GEN_INCLUDE(['../testing/chromevox_unittest_base.js']); | |
7 | |
8 /** | |
9 * @extends {cvox.BrailleInterface} | |
10 * @constructor | |
11 */ | |
12 function FakeBraille() { | |
13 } | |
14 | |
15 FakeBraille.prototype = { | |
16 /** @override */ | |
17 write: function(content) { | |
18 this.content = content; | |
19 } | |
20 }; | |
21 | |
22 /** @constructor */ | |
23 function FakeNavigationManager() { | |
24 } | |
25 | |
26 FakeNavigationManager.prototype = { | |
27 getBraille: function() { | |
28 return this.navBraille; | |
29 }, | |
30 | |
31 setNavBraille: function(navBraille) { | |
32 this.navBraille = navBraille; | |
33 } | |
34 }; | |
35 | |
36 | |
37 /** | |
38 * Test fixture. | |
39 * @constructor | |
40 * @extends {ChromeVoxUnitTestBase} | |
41 */ | |
42 function CvoxBrailleTextHandlerUnitTest() {} | |
43 | |
44 CvoxBrailleTextHandlerUnitTest.prototype = { | |
45 __proto__: ChromeVoxUnitTestBase.prototype, | |
46 | |
47 /** @override */ | |
48 closureModuleDeps: [ | |
49 'cvox.BrailleInterface', | |
50 'cvox.BrailleTextHandler', | |
51 'cvox.NavBraille', | |
52 'cvox.NavigationManager', | |
53 ], | |
54 | |
55 /** @override */ | |
56 setUp: function() { | |
57 this.navigationManager = new FakeNavigationManager(); | |
58 this.braille = new FakeBraille(); | |
59 cvox.ChromeVox.navigationManager = this.navigationManager; | |
60 this.brailleTextHandler = new cvox.BrailleTextHandler(this.braille); | |
61 } | |
62 }; | |
63 | |
64 TEST_F('CvoxBrailleTextHandlerUnitTest', 'UpdateByUser', function() { | |
65 var navBraille = new cvox.NavBraille({ text: 'Hello, world!' }); | |
66 this.navigationManager.setNavBraille(navBraille); | |
67 | |
68 this.brailleTextHandler.changed('', 0, 0, false); | |
69 assertEquals(navBraille, this.braille.content); | |
70 }); | |
OLD | NEW |