OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 * TestFixture for kiosk app settings WebUI testing. | 6 * TestFixture for kiosk app settings WebUI testing. |
7 * @extends {testing.Test} | 7 * @extends {testing.Test} |
8 * @constructor | 8 * @constructor |
9 */ | 9 */ |
10 function AppListStartPageWebUITest() {} | 10 function AppListStartPageWebUITest() {} |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 assertEquals(null, $('doodle_link')); | 155 assertEquals(null, $('doodle_link')); |
156 | 156 |
157 | 157 |
158 appList.startPage.onAppListDoodleUpdated({}, | 158 appList.startPage.onAppListDoodleUpdated({}, |
159 'http://example.com/'); | 159 'http://example.com/'); |
160 assertEquals(null, $('doodle')); | 160 assertEquals(null, $('doodle')); |
161 }); | 161 }); |
162 | 162 |
163 TEST_F('AppListStartPageWebUITest', 'SpeechRecognitionState', function() { | 163 TEST_F('AppListStartPageWebUITest', 'SpeechRecognitionState', function() { |
164 this.mockHandler.expects(once()).setSpeechRecognitionState('READY'); | 164 this.mockHandler.expects(once()).setSpeechRecognitionState('READY'); |
165 appList.startPage.onAppListShown(); | 165 appList.startPage.onAppListShown(false, true); |
166 this.mockHandler.expects(once()).setSpeechRecognitionState('RECOGNIZING'); | 166 this.mockHandler.expects(once()).setSpeechRecognitionState('RECOGNIZING'); |
167 appList.startPage.toggleSpeechRecognition(); | 167 appList.startPage.toggleSpeechRecognition(); |
168 Mock4JS.verifyAllMocks(); | 168 Mock4JS.verifyAllMocks(); |
169 Mock4JS.clearMocksToVerify(); | 169 Mock4JS.clearMocksToVerify(); |
170 | 170 |
171 this.mockHandler.expects(once()).setSpeechRecognitionState('READY'); | 171 this.mockHandler.expects(once()).setSpeechRecognitionState('READY'); |
172 for (var i = 0; i < this.audioTrackMocks.length; ++i) { | 172 for (var i = 0; i < this.audioTrackMocks.length; ++i) { |
173 this.audioTrackMocks[i].expects(once()).stop(); | 173 this.audioTrackMocks[i].expects(once()).stop(); |
174 } | 174 } |
175 appList.startPage.toggleSpeechRecognition(); | 175 appList.startPage.toggleSpeechRecognition(); |
176 Mock4JS.verifyAllMocks(); | 176 Mock4JS.verifyAllMocks(); |
177 Mock4JS.clearMocksToVerify(); | 177 Mock4JS.clearMocksToVerify(); |
178 | 178 |
179 this.mockHandler.expects(once()).setSpeechRecognitionState('RECOGNIZING'); | 179 this.mockHandler.expects(once()).setSpeechRecognitionState('RECOGNIZING'); |
180 appList.startPage.toggleSpeechRecognition(); | 180 appList.startPage.toggleSpeechRecognition(); |
181 Mock4JS.verifyAllMocks(); | 181 Mock4JS.verifyAllMocks(); |
182 Mock4JS.clearMocksToVerify(); | 182 Mock4JS.clearMocksToVerify(); |
183 | 183 |
184 this.mockHandler.expects(once()).setSpeechRecognitionState('STOPPING'); | 184 this.mockHandler.expects(once()).setSpeechRecognitionState('STOPPING'); |
185 this.mockHandler.expects(once()).setSpeechRecognitionState('READY'); | 185 this.mockHandler.expects(once()).setSpeechRecognitionState('READY'); |
186 for (var i = 0; i < this.audioTrackMocks.length; ++i) { | 186 for (var i = 0; i < this.audioTrackMocks.length; ++i) { |
187 this.audioTrackMocks[i].expects(once()).stop(); | 187 this.audioTrackMocks[i].expects(once()).stop(); |
188 } | 188 } |
189 appList.startPage.onAppListHidden(); | 189 appList.startPage.onAppListHidden(); |
190 }); | 190 }); |
191 | 191 |
192 TEST_F('AppListStartPageWebUITest', 'SpeechRecognition', function() { | 192 TEST_F('AppListStartPageWebUITest', 'SpeechRecognition', function() { |
193 this.mockHandler.expects(once()).setSpeechRecognitionState('READY'); | 193 this.mockHandler.expects(once()).setSpeechRecognitionState('READY'); |
194 appList.startPage.onAppListShown(); | 194 appList.startPage.onAppListShown(false, true); |
195 this.mockHandler.expects(once()).setSpeechRecognitionState('RECOGNIZING'); | 195 this.mockHandler.expects(once()).setSpeechRecognitionState('RECOGNIZING'); |
196 appList.startPage.toggleSpeechRecognition(); | 196 appList.startPage.toggleSpeechRecognition(); |
197 Mock4JS.verifyAllMocks(); | 197 Mock4JS.verifyAllMocks(); |
198 Mock4JS.clearMocksToVerify(); | 198 Mock4JS.clearMocksToVerify(); |
199 | 199 |
200 this.mockHandler.expects(once()).setSpeechRecognitionState('IN_SPEECH'); | 200 this.mockHandler.expects(once()).setSpeechRecognitionState('IN_SPEECH'); |
201 this.speechRecognizer.onspeechstart(); | 201 this.speechRecognizer.onspeechstart(); |
202 Mock4JS.verifyAllMocks(); | 202 Mock4JS.verifyAllMocks(); |
203 Mock4JS.clearMocksToVerify(); | 203 Mock4JS.clearMocksToVerify(); |
204 | 204 |
205 this.mockHandler.expects(once()).speechResult('test,false'); | 205 this.mockHandler.expects(once()).speechResult('test,false'); |
206 this.sendSpeechResult('test', false); | 206 this.sendSpeechResult('test', false); |
207 Mock4JS.verifyAllMocks(); | 207 Mock4JS.verifyAllMocks(); |
208 Mock4JS.clearMocksToVerify(); | 208 Mock4JS.clearMocksToVerify(); |
209 | 209 |
210 this.mockHandler.expects(once()).speechResult('test,true'); | 210 this.mockHandler.expects(once()).speechResult('test,true'); |
211 this.mockHandler.expects(once()).setSpeechRecognitionState('READY'); | 211 this.mockHandler.expects(once()).setSpeechRecognitionState('READY'); |
212 for (var i = 0; i < this.audioTrackMocks.length; ++i) { | 212 for (var i = 0; i < this.audioTrackMocks.length; ++i) { |
213 this.audioTrackMocks[i].expects(once()).stop(); | 213 this.audioTrackMocks[i].expects(once()).stop(); |
214 } | 214 } |
215 this.sendSpeechResult('test', true); | 215 this.sendSpeechResult('test', true); |
216 }); | 216 }); |
OLD | NEW |