Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(261)

Side by Side Diff: chrome/browser/ui/webui/app_list/start_page_browsertest.js

Issue 930243009: Add UMA for the app list doodle being clicked. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@uma
Patch Set: fix tests Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 });
OLDNEW
« no previous file with comments | « chrome/browser/ui/app_list/start_page_service.cc ('k') | chrome/browser/ui/webui/app_list/start_page_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698