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

Side by Side Diff: chrome/browser/speech/speech_input_extension_apitest.cc

Issue 10233010: Introducing new data types and IPC messages for scripted JS speech recognition APIs (Speech CL2.0) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Added CONTENT_EXPORT to SpeechRecognitionEngine::Config Created 8 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | content/browser/speech/google_one_shot_remote_engine.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "base/bind.h" 5 #include "base/bind.h"
6 #include "base/command_line.h" 6 #include "base/command_line.h"
7 #include "base/message_loop.h" 7 #include "base/message_loop.h"
8 #include "base/utf_string_conversions.h" 8 #include "base/utf_string_conversions.h"
9 #include "chrome/browser/extensions/extension_apitest.h" 9 #include "chrome/browser/extensions/extension_apitest.h"
10 #include "chrome/browser/speech/speech_input_extension_api.h" 10 #include "chrome/browser/speech/speech_input_extension_api.h"
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 167
168 void SpeechInputExtensionApiTest::StopRecording(bool recognition_failed) { 168 void SpeechInputExtensionApiTest::StopRecording(bool recognition_failed) {
169 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 169 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
170 recognizer_is_valid_ = false; 170 recognizer_is_valid_ = false;
171 } 171 }
172 172
173 void SpeechInputExtensionApiTest::ProvideResults(int session_id) { 173 void SpeechInputExtensionApiTest::ProvideResults(int session_id) {
174 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 174 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
175 175
176 if (next_error_ != content::SPEECH_RECOGNITION_ERROR_NONE) { 176 if (next_error_ != content::SPEECH_RECOGNITION_ERROR_NONE) {
177 GetManager()->OnRecognitionError(session_id, next_error_); 177 GetManager()->OnRecognitionError(
178 session_id, content::SpeechRecognitionError(next_error_));
178 return; 179 return;
179 } 180 }
180 181
181 GetManager()->OnSoundEnd(session_id); 182 GetManager()->OnSoundEnd(session_id);
182 GetManager()->OnAudioEnd(session_id); 183 GetManager()->OnAudioEnd(session_id);
183 GetManager()->OnRecognitionResult(session_id, next_result_); 184 GetManager()->OnRecognitionResult(session_id, next_result_);
184 } 185 }
185 186
186 // Every test should leave the manager in the idle state when finished. 187 // Every test should leave the manager in the idle state when finished.
187 IN_PROC_BROWSER_TEST_F(SpeechInputExtensionApiTest, StartStopTest) { 188 IN_PROC_BROWSER_TEST_F(SpeechInputExtensionApiTest, StartStopTest) {
(...skipping 20 matching lines...) Expand all
208 SetRecognitionResult(result); 209 SetRecognitionResult(result);
209 ASSERT_TRUE(RunExtensionTest("speech_input/recognition")) << message_; 210 ASSERT_TRUE(RunExtensionTest("speech_input/recognition")) << message_;
210 } 211 }
211 212
212 IN_PROC_BROWSER_TEST_F(SpeechInputExtensionApiTest, RecognitionError) { 213 IN_PROC_BROWSER_TEST_F(SpeechInputExtensionApiTest, RecognitionError) {
213 AutoManagerHook hook(this); 214 AutoManagerHook hook(this);
214 215
215 SetRecognitionError(content::SPEECH_RECOGNITION_ERROR_NETWORK); 216 SetRecognitionError(content::SPEECH_RECOGNITION_ERROR_NETWORK);
216 ASSERT_TRUE(RunExtensionTest("speech_input/recognition_error")) << message_; 217 ASSERT_TRUE(RunExtensionTest("speech_input/recognition_error")) << message_;
217 } 218 }
OLDNEW
« no previous file with comments | « no previous file | content/browser/speech/google_one_shot_remote_engine.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698