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

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

Issue 10273006: Introduced SpeechRecognitionDispatcher(Host) classes, handling dispatch of IPC messages for continu… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Test fixed + Satish nits. 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
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/string_number_conversions.h" 9 #include "base/string_number_conversions.h"
10 #include "base/synchronization/waitable_event.h" 10 #include "base/synchronization/waitable_event.h"
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 // no fake result sent. 123 // no fake result sent.
124 EXPECT_TRUE(should_send_fake_response_ || listener_ == listener); 124 EXPECT_TRUE(should_send_fake_response_ || listener_ == listener);
125 did_cancel_all_ = true; 125 did_cancel_all_ = true;
126 } 126 }
127 127
128 virtual bool HasAudioInputDevices() OVERRIDE { return true; } 128 virtual bool HasAudioInputDevices() OVERRIDE { return true; }
129 virtual bool IsCapturingAudio() OVERRIDE { return true; } 129 virtual bool IsCapturingAudio() OVERRIDE { return true; }
130 virtual string16 GetAudioInputDeviceModel() OVERRIDE { return string16(); } 130 virtual string16 GetAudioInputDeviceModel() OVERRIDE { return string16(); }
131 virtual void ShowAudioInputSettings() OVERRIDE {} 131 virtual void ShowAudioInputSettings() OVERRIDE {}
132 132
133 virtual int LookupSessionByContext( 133 virtual int GetSession(int render_process_id,
134 base::Callback<bool( 134 int render_view_id,
135 const content::SpeechRecognitionSessionContext&)> matcher) 135 int request_id) const OVERRIDE {
136 const OVERRIDE { 136 return session_ctx_.render_process_id == render_process_id &&
137 bool matched = matcher.Run(session_ctx_); 137 session_ctx_.render_view_id == render_view_id &&
138 return matched ? session_id_ : 0; 138 session_ctx_.request_id == request_id;
139 } 139 }
140 140
141 virtual const SpeechRecognitionSessionConfig& GetSessionConfig( 141 virtual const SpeechRecognitionSessionConfig& GetSessionConfig(
142 int session_id) const OVERRIDE { 142 int session_id) const OVERRIDE {
143 EXPECT_EQ(session_id, session_id_); 143 EXPECT_EQ(session_id, session_id_);
144 return session_config_; 144 return session_config_;
145 } 145 }
146 146
147 virtual content::SpeechRecognitionSessionContext GetSessionContext( 147 virtual content::SpeechRecognitionSessionContext GetSessionContext(
148 int session_id) const OVERRIDE { 148 int session_id) const OVERRIDE {
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
285 285
286 // Make the renderer crash. This should trigger 286 // Make the renderer crash. This should trigger
287 // InputTagSpeechDispatcherHost to cancel all pending sessions. 287 // InputTagSpeechDispatcherHost to cancel all pending sessions.
288 GURL test_url("about:crash"); 288 GURL test_url("about:crash");
289 ui_test_utils::NavigateToURL(browser(), test_url); 289 ui_test_utils::NavigateToURL(browser(), test_url);
290 290
291 EXPECT_TRUE(fake_speech_recognition_manager_.did_cancel_all()); 291 EXPECT_TRUE(fake_speech_recognition_manager_.did_cancel_all());
292 } 292 }
293 293
294 } // namespace speech 294 } // namespace speech
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698