| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 #include "content/public/test/fake_speech_recognition_manager.h" | 5 #include "content/public/test/fake_speech_recognition_manager.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/location.h" | 8 #include "base/location.h" |
| 9 #include "base/single_thread_task_runner.h" | 9 #include "base/single_thread_task_runner.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 EXPECT_TRUE(should_send_fake_response_ || | 119 EXPECT_TRUE(should_send_fake_response_ || |
| 120 session_ctx_.render_process_id == render_process_id); | 120 session_ctx_.render_process_id == render_process_id); |
| 121 did_cancel_all_ = true; | 121 did_cancel_all_ = true; |
| 122 } | 122 } |
| 123 | 123 |
| 124 void FakeSpeechRecognitionManager::AbortAllSessionsForRenderView( | 124 void FakeSpeechRecognitionManager::AbortAllSessionsForRenderView( |
| 125 int render_process_id, int render_view_id) { | 125 int render_process_id, int render_view_id) { |
| 126 DCHECK(delegate_); // We only expect this to be called via |delegate_|. | 126 DCHECK(delegate_); // We only expect this to be called via |delegate_|. |
| 127 } | 127 } |
| 128 | 128 |
| 129 bool FakeSpeechRecognitionManager::HasAudioInputDevices() { return true; } | |
| 130 | |
| 131 int FakeSpeechRecognitionManager::GetSession(int render_process_id, | 129 int FakeSpeechRecognitionManager::GetSession(int render_process_id, |
| 132 int render_view_id, | 130 int render_view_id, |
| 133 int request_id) const { | 131 int request_id) const { |
| 134 return session_ctx_.render_process_id == render_process_id && | 132 return session_ctx_.render_process_id == render_process_id && |
| 135 session_ctx_.render_view_id == render_view_id && | 133 session_ctx_.render_view_id == render_view_id && |
| 136 session_ctx_.request_id == request_id; | 134 session_ctx_.request_id == request_id; |
| 137 } | 135 } |
| 138 | 136 |
| 139 const SpeechRecognitionSessionConfig& | 137 const SpeechRecognitionSessionConfig& |
| 140 FakeSpeechRecognitionManager::GetSessionConfig(int session_id) const { | 138 FakeSpeechRecognitionManager::GetSessionConfig(int session_id) const { |
| (...skipping 19 matching lines...) Expand all Loading... |
| 160 SpeechRecognitionResults results; | 158 SpeechRecognitionResults results; |
| 161 results.push_back(result); | 159 results.push_back(result); |
| 162 listener_->OnRecognitionResults(session_id_, results); | 160 listener_->OnRecognitionResults(session_id_, results); |
| 163 listener_->OnRecognitionEnd(session_id_); | 161 listener_->OnRecognitionEnd(session_id_); |
| 164 session_id_ = 0; | 162 session_id_ = 0; |
| 165 listener_ = NULL; | 163 listener_ = NULL; |
| 166 VLOG(1) << "Finished setting fake recognition result."; | 164 VLOG(1) << "Finished setting fake recognition result."; |
| 167 } | 165 } |
| 168 | 166 |
| 169 } // namespace content | 167 } // namespace content |
| OLD | NEW |