| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "chrome/browser/ui/app_list/speech_recognizer.h" | 5 #include "chrome/browser/ui/app_list/speech_recognizer.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 | 42 |
| 43 private: | 43 private: |
| 44 base::WeakPtrFactory<MockSpeechRecognizerDelegate> weak_factory_; | 44 base::WeakPtrFactory<MockSpeechRecognizerDelegate> weak_factory_; |
| 45 }; | 45 }; |
| 46 | 46 |
| 47 class AppListSpeechRecognizerBrowserTest : public InProcessBrowserTest { | 47 class AppListSpeechRecognizerBrowserTest : public InProcessBrowserTest { |
| 48 public: | 48 public: |
| 49 AppListSpeechRecognizerBrowserTest() {} | 49 AppListSpeechRecognizerBrowserTest() {} |
| 50 | 50 |
| 51 void SetUpOnMainThread() override { | 51 void SetUpOnMainThread() override { |
| 52 InProcessBrowserTest::SetUpOnMainThread(); | |
| 53 | |
| 54 fake_speech_recognition_manager_.reset( | 52 fake_speech_recognition_manager_.reset( |
| 55 new content::FakeSpeechRecognitionManager()); | 53 new content::FakeSpeechRecognitionManager()); |
| 56 fake_speech_recognition_manager_->set_should_send_fake_response(true); | 54 fake_speech_recognition_manager_->set_should_send_fake_response(true); |
| 57 content::SpeechRecognitionManager::SetManagerForTesting( | 55 content::SpeechRecognitionManager::SetManagerForTesting( |
| 58 fake_speech_recognition_manager_.get()); | 56 fake_speech_recognition_manager_.get()); |
| 59 mock_speech_delegate_.reset(new MockSpeechRecognizerDelegate()); | 57 mock_speech_delegate_.reset(new MockSpeechRecognizerDelegate()); |
| 60 } | 58 } |
| 61 | 59 |
| 62 void TearDownOnMainThread() override { | 60 void TearDownOnMainThread() override { |
| 63 content::RunAllPendingInMessageLoop(content::BrowserThread::IO); | 61 content::RunAllPendingInMessageLoop(content::BrowserThread::IO); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 83 EXPECT_CALL(*mock_speech_delegate_, | 81 EXPECT_CALL(*mock_speech_delegate_, |
| 84 OnSpeechRecognitionStateChanged(SPEECH_RECOGNITION_READY)) | 82 OnSpeechRecognitionStateChanged(SPEECH_RECOGNITION_READY)) |
| 85 .WillOnce(InvokeWithoutArgs(&run_loop, &base::RunLoop::Quit)); | 83 .WillOnce(InvokeWithoutArgs(&run_loop, &base::RunLoop::Quit)); |
| 86 recognizer.Start(nullptr); | 84 recognizer.Start(nullptr); |
| 87 run_loop.Run(); | 85 run_loop.Run(); |
| 88 } | 86 } |
| 89 | 87 |
| 90 } // namespace app_list | 88 } // namespace app_list |
| 91 | 89 |
| 92 | 90 |
| OLD | NEW |