| OLD | NEW |
| (Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CONTENT_BROWSER_SPEECH_MOCK_AUDIO_MANAGER_H_ |
| 6 #define CONTENT_BROWSER_SPEECH_MOCK_AUDIO_MANAGER_H_ |
| 7 #pragma once |
| 8 |
| 9 #include "media/audio/audio_manager_base.h" |
| 10 |
| 11 namespace base { |
| 12 class MessageLoopProxy; |
| 13 } |
| 14 |
| 15 namespace speech { |
| 16 // This class is a simple mock around AudioManagerBase, used exclusively for |
| 17 // tests, which has the following purposes: |
| 18 // 1) Avoids to use the actual (system and platform dependent) AudioManager. |
| 19 // Some bots do not have input devices, thus using the actual AudioManager |
| 20 // would cause failures of the speech code during tests. |
| 21 // 2) Forces the mock audio events to be dispatched on the IO thread, rather on |
| 22 // a dedicated audio thread, easing their handling in the browser tests. |
| 23 // The expected use case for this class is just a call to |
| 24 // AudioManager::set_audio_manager_for_tests(new MockAudioManager()) before |
| 25 // starting the tests, so that subsequent calls to AudioManager::Create(...) |
| 26 // made by production code will be diverted to this class. |
| 27 class MockAudioManager : public media::AudioManagerBase { |
| 28 public: |
| 29 MockAudioManager(); |
| 30 |
| 31 virtual bool HasAudioOutputDevices() OVERRIDE; |
| 32 |
| 33 virtual bool HasAudioInputDevices() OVERRIDE; |
| 34 |
| 35 virtual string16 GetAudioInputDeviceModel() OVERRIDE; |
| 36 |
| 37 virtual bool CanShowAudioInputSettings() OVERRIDE; |
| 38 |
| 39 virtual void ShowAudioInputSettings() OVERRIDE; |
| 40 |
| 41 virtual void GetAudioInputDeviceNames( |
| 42 media::AudioDeviceNames* device_names) OVERRIDE; |
| 43 |
| 44 virtual media::AudioOutputStream* MakeAudioOutputStream( |
| 45 const media::AudioParameters& params) OVERRIDE; |
| 46 |
| 47 virtual media::AudioOutputStream* MakeAudioOutputStreamProxy( |
| 48 const media::AudioParameters& params) OVERRIDE; |
| 49 |
| 50 virtual media::AudioInputStream* MakeAudioInputStream( |
| 51 const media::AudioParameters& params, |
| 52 const std::string& device_id) OVERRIDE; |
| 53 |
| 54 virtual media::AudioOutputStream* MakeLinearOutputStream( |
| 55 const media::AudioParameters& params) OVERRIDE; |
| 56 |
| 57 virtual media::AudioOutputStream* MakeLowLatencyOutputStream( |
| 58 const media::AudioParameters& params) OVERRIDE; |
| 59 |
| 60 virtual media::AudioInputStream* MakeLinearInputStream( |
| 61 const media::AudioParameters& params, |
| 62 const std::string& device_id) OVERRIDE; |
| 63 |
| 64 virtual media::AudioInputStream* MakeLowLatencyInputStream( |
| 65 const media::AudioParameters& params, |
| 66 const std::string& device_id) OVERRIDE; |
| 67 |
| 68 virtual void MuteAll() OVERRIDE; |
| 69 |
| 70 virtual void UnMuteAll() OVERRIDE; |
| 71 |
| 72 virtual bool IsRecordingInProcess() OVERRIDE; |
| 73 |
| 74 virtual scoped_refptr<base::MessageLoopProxy> GetMessageLoop() OVERRIDE; |
| 75 |
| 76 virtual void Init() OVERRIDE; |
| 77 |
| 78 private: |
| 79 virtual ~MockAudioManager(); |
| 80 |
| 81 DISALLOW_COPY_AND_ASSIGN(MockAudioManager); |
| 82 }; |
| 83 |
| 84 } // namespace speech |
| 85 |
| 86 #endif // CONTENT_BROWSER_SPEECH_MOCK_AUDIO_MANAGER_H_ |
| OLD | NEW |