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 // Include test fixture. | 5 // Include test fixture. |
6 GEN_INCLUDE(['../../testing/chromevox_next_e2e_test_base.js']); | 6 GEN_INCLUDE(['../../testing/chromevox_next_e2e_test_base.js']); |
7 | 7 |
8 GEN_INCLUDE(['../../testing/mock_tts.js']); | 8 GEN_INCLUDE(['../../testing/mock_tts.js']); |
9 | 9 |
10 /** | 10 /** |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 | 85 |
86 chrome.automation.getDesktop(function(root) { | 86 chrome.automation.getDesktop(function(root) { |
87 var testButton = findStatusTray(root); | 87 var testButton = findStatusTray(root); |
88 cvox.ChromeVox.tts.expectSpeech('Status tray', testDone); | 88 cvox.ChromeVox.tts.expectSpeech('Status tray', testDone); |
89 testButton.focus(); | 89 testButton.focus(); |
90 }); | 90 }); |
91 }); | 91 }); |
92 | 92 |
93 /** Tests feedback once a page loads. */ | 93 /** Tests feedback once a page loads. */ |
94 TEST_F('BackgroundTest', 'InitialFeedback', function() { | 94 TEST_F('BackgroundTest', 'InitialFeedback', function() { |
95 cvox.ChromeVox.tts.expectSpeech('start', testDone); | 95 cvox.ChromeVox.tts.expectSpeech('start', function() { |
| 96 global.backgroundObj.onGotCommand('nextLine'); |
| 97 }, true); |
| 98 cvox.ChromeVox.tts.expectSpeech('end', testDone, true); |
96 | 99 |
97 this.runWithTab(function() {/*! | 100 this.runWithDocument(function() {/*! |
98 <p>start | 101 <p>start |
99 <p>end | 102 <p>end |
100 */}); | 103 */}, |
| 104 function() {}); |
101 }); | 105 }); |
102 | 106 |
103 /** Tests consistency of navigating forward and backward. */ | 107 /** Tests consistency of navigating forward and backward. */ |
104 TEST_F('BackgroundTest', 'ForwardBackwardNavigation', function() { | 108 TEST_F('BackgroundTest', 'ForwardBackwardNavigation', function() { |
105 this.runWithLoadedTree(this.linksAndHeadingsDoc, function() { | 109 cvox.ChromeVox.tts.expectSpeech('start', null, true); |
| 110 this.runWithDocument(this.linksAndHeadingsDoc, function() { |
106 var doCmd = this.doCmd.bind(this); | 111 var doCmd = this.doCmd.bind(this); |
107 var expectAfter = | 112 var expectAfter = |
108 cvox.ChromeVox.tts.expectSpeechAfter.bind(cvox.ChromeVox.tts); | 113 cvox.ChromeVox.tts.expectSpeechAfter.bind(cvox.ChromeVox.tts); |
109 | 114 |
110 expectAfter('alpha', doCmd('nextLink')); | 115 expectAfter('alpha', doCmd('nextLink')); |
111 expectAfter('beta', doCmd('nextLink')); | 116 expectAfter('beta', doCmd('nextLink')); |
112 expectAfter('delta', doCmd('nextLink')); | 117 expectAfter('delta', doCmd('nextLink')); |
113 expectAfter('beta', doCmd('previousLink')); | 118 expectAfter('beta', doCmd('previousLink')); |
114 | 119 |
115 expectAfter('charlie', doCmd('nextHeading')); | 120 expectAfter('charlie', doCmd('nextHeading')); |
116 expectAfter('foxtraut', doCmd('nextHeading')); | 121 expectAfter('foxtraut', doCmd('nextHeading')); |
117 expectAfter('charlie', doCmd('previousHeading')); | 122 expectAfter('charlie', doCmd('previousHeading')); |
118 | 123 |
119 expectAfter('delta', doCmd('nextElement')); | 124 expectAfter('delta', doCmd('nextElement')); |
120 expectAfter('echo', doCmd('nextElement')); | 125 expectAfter('echo', doCmd('nextElement')); |
121 expectAfter('foxtraut', doCmd('nextElement')); | 126 expectAfter('foxtraut', doCmd('nextElement')); |
122 expectAfter('end', doCmd('nextElement')); | 127 expectAfter('end', doCmd('nextElement')); |
123 expectAfter('foxtraut', doCmd('previousElement')); | 128 expectAfter('foxtraut', doCmd('previousElement')); |
124 expectAfter('end of test', doCmd('nextLine')); | 129 expectAfter('end of test', doCmd('nextLine')); |
125 | 130 |
126 expectAfter('start', doCmd('goToBeginning')); | 131 expectAfter('start', doCmd('goToBeginning')); |
127 expectAfter('of test', doCmd('goToEnd')); | 132 expectAfter('of test', doCmd('goToEnd')); |
128 | 133 |
129 cvox.ChromeVox.tts.finishExpectations(); | 134 cvox.ChromeVox.tts.finishExpectations(); |
130 }.bind(this) | 135 }.bind(this) |
131 ); | 136 ); |
132 }); | 137 }); |
133 | 138 |
134 TEST_F('BackgroundTest', 'CaretNavigation', function() { | 139 TEST_F('BackgroundTest', 'CaretNavigation', function() { |
135 this.runWithLoadedTree(this.linksAndHeadingsDoc, function() { | 140 cvox.ChromeVox.tts.expectSpeech('start', null, true); |
| 141 this.runWithDocument(this.linksAndHeadingsDoc, function() { |
136 var doCmd = this.doCmd.bind(this); | 142 var doCmd = this.doCmd.bind(this); |
137 var expectAfter = | 143 var expectAfter = |
138 cvox.ChromeVox.tts.expectSpeechAfter.bind(cvox.ChromeVox.tts); | 144 cvox.ChromeVox.tts.expectSpeechAfter.bind(cvox.ChromeVox.tts); |
139 | 145 |
140 expectAfter('t', doCmd('nextCharacter'), true); | 146 expectAfter('t', doCmd('nextCharacter'), true); |
141 expectAfter('a', doCmd('nextCharacter'), true); | 147 expectAfter('a', doCmd('nextCharacter'), true); |
142 expectAfter('Link alpha', doCmd('nextWord'), true); | 148 expectAfter('Link alpha', doCmd('nextWord'), true); |
143 expectAfter('Link beta', doCmd('nextWord'), true); | 149 expectAfter('Link beta', doCmd('nextWord'), true); |
144 expectAfter('Heading charlie', doCmd('nextWord'), true); | 150 expectAfter('Heading charlie', doCmd('nextWord'), true); |
145 expectAfter('Link delta', doCmd('nextLine'), true); | 151 expectAfter('Link delta', doCmd('nextLine'), true); |
146 expectAfter('Link echo', doCmd('nextLine'), true); | 152 expectAfter('Link echo', doCmd('nextLine'), true); |
147 expectAfter('Heading foxtraut', doCmd('nextLine'), true); | 153 expectAfter('Heading foxtraut', doCmd('nextLine'), true); |
148 expectAfter( | 154 expectAfter( |
149 'end of test', doCmd('nextLine'), true); | 155 'end of test', doCmd('nextLine'), true); |
150 expectAfter('n', doCmd('nextCharacter'), true); | 156 expectAfter('n', doCmd('nextCharacter'), true); |
151 expectAfter('e', doCmd('previousCharacter'), true); | 157 expectAfter('e', doCmd('previousCharacter'), true); |
152 expectAfter('Heading t', doCmd('previousCharacter'), true); | 158 expectAfter('Heading t', doCmd('previousCharacter'), true); |
153 expectAfter('foxtraut', doCmd('previousWord'), true); | 159 expectAfter('foxtraut', doCmd('previousWord'), true); |
154 expectAfter('Link echo', doCmd('previousWord'), true); | 160 expectAfter('Link echo', doCmd('previousWord'), true); |
155 expectAfter('Link a', doCmd('previousCharacter'), true); | 161 expectAfter('Link a', doCmd('previousCharacter'), true); |
156 expectAfter('t', doCmd('previousCharacter'), true); | 162 expectAfter('t', doCmd('previousCharacter'), true); |
157 expectAfter('Link echo', doCmd('nextWord'), true); | 163 expectAfter('Link echo', doCmd('nextWord'), true); |
158 | 164 |
159 cvox.ChromeVox.tts.finishExpectations(); | 165 cvox.ChromeVox.tts.finishExpectations(); |
160 }.bind(this)); | 166 }.bind(this)); |
161 }); | 167 }); |
162 | 168 |
163 // Flaky: http://crbug.com/451362 | 169 // Flaky: http://crbug.com/451362 |
164 TEST_F('BackgroundTest', 'DISABLED_SelectSingleBasic', function() { | 170 TEST_F('BackgroundTest', 'DISABLED_SelectSingleBasic', function() { |
165 this.runWithLoadedTree(this.formsDoc, function(tabId) { | 171 this.runWithDocument(this.formsDoc, function(tabId) { |
166 var sendDownToSelect = | 172 var sendDownToSelect = |
167 this.sendKeyToElement.bind(this, tabId, 'Down', '#fruitSelect'); | 173 this.sendKeyToElement.bind(this, tabId, 'Down', '#fruitSelect'); |
168 var expect = cvox.ChromeVox.tts.expectSpeech.bind(cvox.ChromeVox.tts); | 174 var expect = cvox.ChromeVox.tts.expectSpeech.bind(cvox.ChromeVox.tts); |
169 expect('apple Menu item 1 of 3 ', sendDownToSelect, true); | 175 expect('apple Menu item 1 of 3 ', sendDownToSelect, true); |
170 expect('grape 2 of 3 ', sendDownToSelect, true); | 176 expect('grape 2 of 3 ', sendDownToSelect, true); |
171 expect('banana 3 of 3 ', testDone, true); | 177 expect('banana 3 of 3 ', testDone, true); |
172 cvox.ChromeVox.tts.finishExpectations(); | 178 cvox.ChromeVox.tts.finishExpectations(); |
173 }.bind(this)); | 179 }.bind(this)); |
174 }); | 180 }); |
175 | 181 |
176 TEST_F('BackgroundTest', 'ContinuousRead', function() { | 182 TEST_F('BackgroundTest', 'ContinuousRead', function() { |
177 this.runWithLoadedTree(this.linksAndHeadingsDoc, function() { | 183 cvox.ChromeVox.tts.expectSpeech('start', null, true); |
| 184 this.runWithDocument(this.linksAndHeadingsDoc, function() { |
178 var doCmd = this.doCmd.bind(this); | 185 var doCmd = this.doCmd.bind(this); |
179 var expect = | 186 var expect = |
180 cvox.ChromeVox.tts.expectSpeechAfter.bind(cvox.ChromeVox.tts); | 187 cvox.ChromeVox.tts.expectSpeechAfter.bind(cvox.ChromeVox.tts); |
181 var sendEndEvent = function() { | 188 var sendEndEvent = function() { |
182 window.setTimeout(function() { | 189 window.setTimeout(function() { |
183 this.sendEndEvent(); | 190 this.sendEndEvent(); |
184 }.bind(this), 0); | 191 }.bind(this), 0); |
185 }.bind(cvox.ChromeVox.tts); | 192 }.bind(cvox.ChromeVox.tts); |
186 | 193 |
187 expect('start', doCmd('continuousRead')); | 194 expect('start', doCmd('continuousRead')); |
188 expect('alpha Link', sendEndEvent); | 195 expect('alpha Link', sendEndEvent); |
189 expect('beta Link', sendEndEvent); | 196 expect('beta Link', sendEndEvent); |
190 expect('Heading charlie', sendEndEvent); | 197 expect('Heading charlie', sendEndEvent); |
191 cvox.ChromeVox.tts.finishExpectations(); | 198 cvox.ChromeVox.tts.finishExpectations(); |
192 }.bind(this)); | 199 }.bind(this)); |
193 }); | 200 }); |
OLD | NEW |