| 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/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
| 9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
| 10 #include "content/public/browser/speech_recognition_event_listener.h" | 10 #include "content/public/browser/speech_recognition_event_listener.h" |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 listener_(NULL), | 27 listener_(NULL), |
| 28 fake_result_(kTestResult), | 28 fake_result_(kTestResult), |
| 29 did_cancel_all_(false), | 29 did_cancel_all_(false), |
| 30 should_send_fake_response_(true) { | 30 should_send_fake_response_(true) { |
| 31 } | 31 } |
| 32 | 32 |
| 33 FakeSpeechRecognitionManager::~FakeSpeechRecognitionManager() { | 33 FakeSpeechRecognitionManager::~FakeSpeechRecognitionManager() { |
| 34 } | 34 } |
| 35 | 35 |
| 36 void FakeSpeechRecognitionManager::WaitForRecognitionStarted() { | 36 void FakeSpeechRecognitionManager::WaitForRecognitionStarted() { |
| 37 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 37 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 38 scoped_refptr<MessageLoopRunner> runner = new MessageLoopRunner; | 38 scoped_refptr<MessageLoopRunner> runner = new MessageLoopRunner; |
| 39 recognition_started_closure_ = runner->QuitClosure(); | 39 recognition_started_closure_ = runner->QuitClosure(); |
| 40 runner->Run(); | 40 runner->Run(); |
| 41 recognition_started_closure_.Reset(); | 41 recognition_started_closure_.Reset(); |
| 42 } | 42 } |
| 43 | 43 |
| 44 void FakeSpeechRecognitionManager::SetFakeResult(const std::string& value) { | 44 void FakeSpeechRecognitionManager::SetFakeResult(const std::string& value) { |
| 45 fake_result_ = value; | 45 fake_result_ = value; |
| 46 } | 46 } |
| 47 | 47 |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 SpeechRecognitionResults results; | 149 SpeechRecognitionResults results; |
| 150 results.push_back(result); | 150 results.push_back(result); |
| 151 listener_->OnRecognitionResults(session_id_, results); | 151 listener_->OnRecognitionResults(session_id_, results); |
| 152 listener_->OnRecognitionEnd(session_id_); | 152 listener_->OnRecognitionEnd(session_id_); |
| 153 session_id_ = 0; | 153 session_id_ = 0; |
| 154 listener_ = NULL; | 154 listener_ = NULL; |
| 155 VLOG(1) << "Finished setting fake recognition result."; | 155 VLOG(1) << "Finished setting fake recognition result."; |
| 156 } | 156 } |
| 157 | 157 |
| 158 } // namespace content | 158 } // namespace content |
| OLD | NEW |