| 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 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 assertNotEquals(null, $('doodle')); | 152 assertNotEquals(null, $('doodle')); |
| 153 assertEquals('http://example.com/x/doodle.png', $('doodle_image').src); | 153 assertEquals('http://example.com/x/doodle.png', $('doodle_image').src); |
| 154 assertEquals('', $('doodle_image').title); | 154 assertEquals('', $('doodle_image').title); |
| 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 | |
| 163 TEST_F('AppListStartPageWebUITest', 'SpeechRecognitionState', function() { | |
| 164 this.mockHandler.expects(once()).setSpeechRecognitionState('READY'); | |
| 165 appList.startPage.onAppListShown(false, true); | |
| 166 this.mockHandler.expects(once()).setSpeechRecognitionState('RECOGNIZING'); | |
| 167 appList.startPage.toggleSpeechRecognition(); | |
| 168 Mock4JS.verifyAllMocks(); | |
| 169 Mock4JS.clearMocksToVerify(); | |
| 170 | |
| 171 this.mockHandler.expects(once()).setSpeechRecognitionState('READY'); | |
| 172 for (var i = 0; i < this.audioTrackMocks.length; ++i) { | |
| 173 this.audioTrackMocks[i].expects(once()).stop(); | |
| 174 } | |
| 175 appList.startPage.toggleSpeechRecognition(); | |
| 176 Mock4JS.verifyAllMocks(); | |
| 177 Mock4JS.clearMocksToVerify(); | |
| 178 | |
| 179 this.mockHandler.expects(once()).setSpeechRecognitionState('RECOGNIZING'); | |
| 180 appList.startPage.toggleSpeechRecognition(); | |
| 181 Mock4JS.verifyAllMocks(); | |
| 182 Mock4JS.clearMocksToVerify(); | |
| 183 | |
| 184 this.mockHandler.expects(once()).setSpeechRecognitionState('STOPPING'); | |
| 185 this.mockHandler.expects(once()).setSpeechRecognitionState('READY'); | |
| 186 for (var i = 0; i < this.audioTrackMocks.length; ++i) { | |
| 187 this.audioTrackMocks[i].expects(once()).stop(); | |
| 188 } | |
| 189 appList.startPage.onAppListHidden(); | |
| 190 }); | |
| 191 | |
| 192 TEST_F('AppListStartPageWebUITest', 'SpeechRecognition', function() { | |
| 193 this.mockHandler.expects(once()).setSpeechRecognitionState('READY'); | |
| 194 appList.startPage.onAppListShown(false, true); | |
| 195 this.mockHandler.expects(once()).setSpeechRecognitionState('RECOGNIZING'); | |
| 196 appList.startPage.toggleSpeechRecognition(); | |
| 197 Mock4JS.verifyAllMocks(); | |
| 198 Mock4JS.clearMocksToVerify(); | |
| 199 | |
| 200 this.mockHandler.expects(once()).setSpeechRecognitionState('IN_SPEECH'); | |
| 201 this.speechRecognizer.onspeechstart(); | |
| 202 Mock4JS.verifyAllMocks(); | |
| 203 Mock4JS.clearMocksToVerify(); | |
| 204 | |
| 205 this.mockHandler.expects(once()).speechResult('test,false'); | |
| 206 this.sendSpeechResult('test', false); | |
| 207 Mock4JS.verifyAllMocks(); | |
| 208 Mock4JS.clearMocksToVerify(); | |
| 209 | |
| 210 this.mockHandler.expects(once()).speechResult('test,true'); | |
| 211 this.mockHandler.expects(once()).setSpeechRecognitionState('READY'); | |
| 212 for (var i = 0; i < this.audioTrackMocks.length; ++i) { | |
| 213 this.audioTrackMocks[i].expects(once()).stop(); | |
| 214 } | |
| 215 this.sendSpeechResult('test', true); | |
| 216 }); | |
| OLD | NEW |