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 goog.provide('cvox.ChromeVoxTester'); | 5 goog.provide('cvox.ChromeVoxTester'); |
6 | 6 |
7 goog.require('TestMsgs'); | 7 goog.require('TestMsgs'); |
8 goog.require('cvox.AbstractEarcons'); | 8 goog.require('cvox.AbstractEarcons'); |
9 goog.require('cvox.BrailleInterface'); | 9 goog.require('cvox.BrailleInterface'); |
10 goog.require('cvox.ChromeVoxEventWatcher'); | 10 goog.require('cvox.ChromeVoxEventWatcher'); |
(...skipping 20 matching lines...) Expand all Loading... |
31 */ | 31 */ |
32 cvox.ChromeVoxTester.setUp = function(doc) { | 32 cvox.ChromeVoxTester.setUp = function(doc) { |
33 cvox.ChromeVox.mathJax = new cvox.TestMathJax(); | 33 cvox.ChromeVox.mathJax = new cvox.TestMathJax(); |
34 | 34 |
35 cvox.ChromeVox.navigationManager = new cvox.NavigationManager(); | 35 cvox.ChromeVox.navigationManager = new cvox.NavigationManager(); |
36 cvox.ChromeVoxTester.testTts_ = new cvox.TestTts(); | 36 cvox.ChromeVoxTester.testTts_ = new cvox.TestTts(); |
37 cvox.ChromeVox.tts = cvox.ChromeVoxTester.testTts_; | 37 cvox.ChromeVox.tts = cvox.ChromeVoxTester.testTts_; |
38 | 38 |
39 // TODO(deboer): Factor this out as 'TestEarcons' | 39 // TODO(deboer): Factor this out as 'TestEarcons' |
40 cvox.ChromeVox.earcons = new cvox.AbstractEarcons(); | 40 cvox.ChromeVox.earcons = new cvox.AbstractEarcons(); |
41 cvox.ChromeVox.earcons.playEarcon = function(earcon) { }; | 41 cvox.ChromeVox.earcons.playEarcon = function(earcon) {}; |
42 | 42 |
43 cvox.ChromeVox.braille = new cvox.BrailleInterface(); | 43 cvox.ChromeVox.braille = new cvox.BrailleInterface(); |
44 cvox.ChromeVox.braille.write = function(params) {}; | 44 cvox.ChromeVox.braille.write = function(params) {}; |
45 | 45 |
46 Msgs = TestMsgs; | 46 Msgs = TestMsgs; |
47 | 47 |
48 cvox.ChromeVox.host = new cvox.TestHost(); | 48 cvox.ChromeVox.host = new cvox.TestHost(); |
49 | 49 |
50 // Init LiveRegions with a date of 0 so that the initial delay before | 50 // Init LiveRegions with a date of 0 so that the initial delay before |
51 // things is spoken is skipped. | 51 // things is spoken is skipped. |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 'selection': cvox.NavigationShifter.GRANULARITIES.SENTENCE | 101 'selection': cvox.NavigationShifter.GRANULARITIES.SENTENCE |
102 }; | 102 }; |
103 | 103 |
104 /** | 104 /** |
105 * Switches to a different navigation strategy. | 105 * Switches to a different navigation strategy. |
106 * @param {string} strategy The desired navigation strategy. | 106 * @param {string} strategy The desired navigation strategy. |
107 */ | 107 */ |
108 cvox.ChromeVoxTester.setStrategy = function(strategy) { | 108 cvox.ChromeVoxTester.setStrategy = function(strategy) { |
109 cvox.ChromeVox.navigationManager.ensureNotSubnavigating(); | 109 cvox.ChromeVox.navigationManager.ensureNotSubnavigating(); |
110 cvox.ChromeVox.navigationManager.setGranularity( | 110 cvox.ChromeVox.navigationManager.setGranularity( |
111 cvox.ChromeVoxTester.STRATEGY_MAP[strategy]); | 111 cvox.ChromeVoxTester.STRATEGY_MAP[strategy]); |
112 }; | 112 }; |
113 | 113 |
114 /** | 114 /** |
115 * Starts reading the page from the current node. | 115 * Starts reading the page from the current node. |
116 */ | 116 */ |
117 cvox.ChromeVoxTester.readFromHere = function() { | 117 cvox.ChromeVoxTester.readFromHere = function() { |
118 cvox.ChromeVox.navigationManager.startReading( | 118 cvox.ChromeVox.navigationManager.startReading(cvox.QueueMode.FLUSH); |
119 cvox.QueueMode.FLUSH); | |
120 }; | 119 }; |
121 | 120 |
122 /** | 121 /** |
123 * Syncs to the given node in the test HTML | 122 * Syncs to the given node in the test HTML |
124 * @param {Node} node The node to sync to. | 123 * @param {Node} node The node to sync to. |
125 */ | 124 */ |
126 cvox.ChromeVoxTester.syncToNode = function(node) { | 125 cvox.ChromeVoxTester.syncToNode = function(node) { |
127 cvox.ChromeVox.navigationManager | 126 cvox.ChromeVox.navigationManager.updateSel( |
128 .updateSel(cvox.CursorSelection.fromNode(node)); | 127 cvox.CursorSelection.fromNode(node)); |
129 cvox.ChromeVox.navigationManager.sync(); | 128 cvox.ChromeVox.navigationManager.sync(); |
130 }; | 129 }; |
131 | 130 |
132 /** | 131 /** |
133 * Syncs to the first node in the test. | 132 * Syncs to the first node in the test. |
134 */ | 133 */ |
135 cvox.ChromeVoxTester.syncToFirstNode = function() { | 134 cvox.ChromeVoxTester.syncToFirstNode = function() { |
136 cvox.ChromeVox.navigationManager.updateSel(cvox.CursorSelection.fromBody()); | 135 cvox.ChromeVox.navigationManager.updateSel(cvox.CursorSelection.fromBody()); |
137 cvox.ChromeVox.navigationManager.sync(); | 136 cvox.ChromeVox.navigationManager.sync(); |
138 }; | 137 }; |
OLD | NEW |