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

Side by Side Diff: content/browser/speech/speech_recognition_browsertest.cc

Issue 11316330: Revert 170701 since the WebKit change has now been rolled in again. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years 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
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/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
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 results; 156 SpeechRecognitionResult result;
157 results.hypotheses.push_back(SpeechRecognitionHypothesis( 157 result.hypotheses.push_back(SpeechRecognitionHypothesis(
158 ASCIIToUTF16(kTestResult), 1.0)); 158 ASCIIToUTF16(kTestResult), 1.0));
159 listener_->OnRecognitionResult(session_id_, results); 159 SpeechRecognitionResults results;
160 results.push_back(result);
161 listener_->OnRecognitionResults(session_id_, results);
160 listener_->OnRecognitionEnd(session_id_); 162 listener_->OnRecognitionEnd(session_id_);
161 session_id_ = 0; 163 session_id_ = 0;
162 listener_ = NULL; 164 listener_ = NULL;
163 VLOG(1) << "Finished setting fake recognition result."; 165 VLOG(1) << "Finished setting fake recognition result.";
164 } 166 }
165 } 167 }
166 168
167 int session_id_; 169 int session_id_;
168 SpeechRecognitionEventListener* listener_; 170 SpeechRecognitionEventListener* listener_;
169 SpeechRecognitionSessionConfig session_config_; 171 SpeechRecognitionSessionConfig session_config_;
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
277 LoadAndStartSpeechRecognitionTest("basic_recognition.html"); 279 LoadAndStartSpeechRecognitionTest("basic_recognition.html");
278 280
279 // Make the renderer crash. This should trigger 281 // Make the renderer crash. This should trigger
280 // InputTagSpeechDispatcherHost to cancel all pending sessions. 282 // InputTagSpeechDispatcherHost to cancel all pending sessions.
281 NavigateToURL(shell(), GURL(chrome::kChromeUICrashURL)); 283 NavigateToURL(shell(), GURL(chrome::kChromeUICrashURL));
282 284
283 EXPECT_TRUE(fake_speech_recognition_manager_.did_cancel_all()); 285 EXPECT_TRUE(fake_speech_recognition_manager_.did_cancel_all());
284 } 286 }
285 287
286 } // namespace content 288 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698