| 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 "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/memory/weak_ptr.h" | 8 #include "base/memory/weak_ptr.h" |
| 9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 MockSpeechRecognizerDelegate() : weak_factory_(this) {} | 30 MockSpeechRecognizerDelegate() : weak_factory_(this) {} |
| 31 | 31 |
| 32 base::WeakPtr<MockSpeechRecognizerDelegate> GetWeakPtr() { | 32 base::WeakPtr<MockSpeechRecognizerDelegate> GetWeakPtr() { |
| 33 return weak_factory_.GetWeakPtr(); | 33 return weak_factory_.GetWeakPtr(); |
| 34 } | 34 } |
| 35 | 35 |
| 36 MOCK_METHOD2(OnSpeechResult, void(const base::string16&, bool)); | 36 MOCK_METHOD2(OnSpeechResult, void(const base::string16&, bool)); |
| 37 MOCK_METHOD1(OnSpeechSoundLevelChanged, void(int16_t)); | 37 MOCK_METHOD1(OnSpeechSoundLevelChanged, void(int16_t)); |
| 38 MOCK_METHOD1(OnSpeechRecognitionStateChanged, void(SpeechRecognitionState)); | 38 MOCK_METHOD1(OnSpeechRecognitionStateChanged, void(SpeechRecognitionState)); |
| 39 MOCK_METHOD0(GetSpeechContents, content::WebContents*()); | 39 MOCK_METHOD0(GetSpeechContents, content::WebContents*()); |
| 40 MOCK_METHOD2(GetSpeechAuthParameters, void(std::string*, std::string*)); |
| 40 | 41 |
| 41 private: | 42 private: |
| 42 base::WeakPtrFactory<MockSpeechRecognizerDelegate> weak_factory_; | 43 base::WeakPtrFactory<MockSpeechRecognizerDelegate> weak_factory_; |
| 43 }; | 44 }; |
| 44 | 45 |
| 45 class AppListSpeechRecognizerBrowserTest : public InProcessBrowserTest { | 46 class AppListSpeechRecognizerBrowserTest : public InProcessBrowserTest { |
| 46 public: | 47 public: |
| 47 AppListSpeechRecognizerBrowserTest() {} | 48 AppListSpeechRecognizerBrowserTest() {} |
| 48 | 49 |
| 49 void SetUpOnMainThread() override { | 50 void SetUpOnMainThread() override { |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 EXPECT_CALL(*mock_speech_delegate_, | 99 EXPECT_CALL(*mock_speech_delegate_, |
| 99 OnSpeechRecognitionStateChanged(SPEECH_RECOGNITION_READY)) | 100 OnSpeechRecognitionStateChanged(SPEECH_RECOGNITION_READY)) |
| 100 .WillOnce(InvokeWithoutArgs(&run_loop, &base::RunLoop::Quit)); | 101 .WillOnce(InvokeWithoutArgs(&run_loop, &base::RunLoop::Quit)); |
| 101 recognizer.Start(); | 102 recognizer.Start(); |
| 102 run_loop.Run(); | 103 run_loop.Run(); |
| 103 } | 104 } |
| 104 | 105 |
| 105 } // namespace app_list | 106 } // namespace app_list |
| 106 | 107 |
| 107 | 108 |
| OLD | NEW |