OLD | NEW |
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/file_path.h" | 7 #include "base/file_path.h" |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
10 #include "base/string_number_conversions.h" | 10 #include "base/string_number_conversions.h" |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 int session_id) const OVERRIDE { | 146 int session_id) const OVERRIDE { |
147 EXPECT_EQ(session_id, session_id_); | 147 EXPECT_EQ(session_id, session_id_); |
148 return session_ctx_; | 148 return session_ctx_; |
149 } | 149 } |
150 | 150 |
151 private: | 151 private: |
152 void SetFakeRecognitionResult() { | 152 void SetFakeRecognitionResult() { |
153 if (session_id_) { // Do a check in case we were cancelled.. | 153 if (session_id_) { // Do a check in case we were cancelled.. |
154 VLOG(1) << "Setting fake recognition result."; | 154 VLOG(1) << "Setting fake recognition result."; |
155 listener_->OnAudioEnd(session_id_); | 155 listener_->OnAudioEnd(session_id_); |
156 SpeechRecognitionResult result; | 156 SpeechRecognitionResult results; |
157 result.hypotheses.push_back(SpeechRecognitionHypothesis( | 157 results.hypotheses.push_back(SpeechRecognitionHypothesis( |
158 ASCIIToUTF16(kTestResult), 1.0)); | 158 ASCIIToUTF16(kTestResult), 1.0)); |
159 SpeechRecognitionResults results; | 159 listener_->OnRecognitionResult(session_id_, results); |
160 results.push_back(result); | |
161 listener_->OnRecognitionResults(session_id_, results); | |
162 listener_->OnRecognitionEnd(session_id_); | 160 listener_->OnRecognitionEnd(session_id_); |
163 session_id_ = 0; | 161 session_id_ = 0; |
164 listener_ = NULL; | 162 listener_ = NULL; |
165 VLOG(1) << "Finished setting fake recognition result."; | 163 VLOG(1) << "Finished setting fake recognition result."; |
166 } | 164 } |
167 } | 165 } |
168 | 166 |
169 int session_id_; | 167 int session_id_; |
170 SpeechRecognitionEventListener* listener_; | 168 SpeechRecognitionEventListener* listener_; |
171 SpeechRecognitionSessionConfig session_config_; | 169 SpeechRecognitionSessionConfig session_config_; |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
279 LoadAndStartSpeechRecognitionTest("basic_recognition.html"); | 277 LoadAndStartSpeechRecognitionTest("basic_recognition.html"); |
280 | 278 |
281 // Make the renderer crash. This should trigger | 279 // Make the renderer crash. This should trigger |
282 // InputTagSpeechDispatcherHost to cancel all pending sessions. | 280 // InputTagSpeechDispatcherHost to cancel all pending sessions. |
283 NavigateToURL(shell(), GURL(chrome::kChromeUICrashURL)); | 281 NavigateToURL(shell(), GURL(chrome::kChromeUICrashURL)); |
284 | 282 |
285 EXPECT_TRUE(fake_speech_recognition_manager_.did_cancel_all()); | 283 EXPECT_TRUE(fake_speech_recognition_manager_.did_cancel_all()); |
286 } | 284 } |
287 | 285 |
288 } // namespace content | 286 } // namespace content |
OLD | NEW |