| Index: content/browser/speech/mock_audio_manager.h
|
| diff --git a/content/browser/speech/mock_audio_manager.h b/content/browser/speech/mock_audio_manager.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..5daa57f3c085a1aa170bac9164e35b927d1e9ebf
|
| --- /dev/null
|
| +++ b/content/browser/speech/mock_audio_manager.h
|
| @@ -0,0 +1,86 @@
|
| +// Copyright (c) 2012 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#ifndef CONTENT_BROWSER_SPEECH_MOCK_AUDIO_MANAGER_H_
|
| +#define CONTENT_BROWSER_SPEECH_MOCK_AUDIO_MANAGER_H_
|
| +#pragma once
|
| +
|
| +#include "media/audio/audio_manager_base.h"
|
| +
|
| +namespace base {
|
| +class MessageLoopProxy;
|
| +}
|
| +
|
| +namespace speech {
|
| +// This class is a simple mock around AudioManagerBase, used exclusively for
|
| +// tests, which has the following purposes:
|
| +// 1) Avoids to use the actual (system and platform dependent) AudioManager.
|
| +// Some bots do not have input devices, thus using the actual AudioManager
|
| +// would cause failures of the speech code during tests.
|
| +// 2) Forces the mock audio events to be dispatched on the IO thread, rather on
|
| +// a dedicated audio thread, easing their handling in the browser tests.
|
| +// The expected use case for this class is just a call to
|
| +// AudioManager::set_audio_manager_for_tests(new MockAudioManager()) before
|
| +// starting the tests, so that subsequent calls to AudioManager::Create(...)
|
| +// made by production code will be diverted to this class.
|
| +class MockAudioManager : public media::AudioManagerBase {
|
| + public:
|
| + MockAudioManager();
|
| +
|
| + virtual bool HasAudioOutputDevices() OVERRIDE;
|
| +
|
| + virtual bool HasAudioInputDevices() OVERRIDE;
|
| +
|
| + virtual string16 GetAudioInputDeviceModel() OVERRIDE;
|
| +
|
| + virtual bool CanShowAudioInputSettings() OVERRIDE;
|
| +
|
| + virtual void ShowAudioInputSettings() OVERRIDE;
|
| +
|
| + virtual void GetAudioInputDeviceNames(
|
| + media::AudioDeviceNames* device_names) OVERRIDE;
|
| +
|
| + virtual media::AudioOutputStream* MakeAudioOutputStream(
|
| + const media::AudioParameters& params) OVERRIDE;
|
| +
|
| + virtual media::AudioOutputStream* MakeAudioOutputStreamProxy(
|
| + const media::AudioParameters& params) OVERRIDE;
|
| +
|
| + virtual media::AudioInputStream* MakeAudioInputStream(
|
| + const media::AudioParameters& params,
|
| + const std::string& device_id) OVERRIDE;
|
| +
|
| + virtual media::AudioOutputStream* MakeLinearOutputStream(
|
| + const media::AudioParameters& params) OVERRIDE;
|
| +
|
| + virtual media::AudioOutputStream* MakeLowLatencyOutputStream(
|
| + const media::AudioParameters& params) OVERRIDE;
|
| +
|
| + virtual media::AudioInputStream* MakeLinearInputStream(
|
| + const media::AudioParameters& params,
|
| + const std::string& device_id) OVERRIDE;
|
| +
|
| + virtual media::AudioInputStream* MakeLowLatencyInputStream(
|
| + const media::AudioParameters& params,
|
| + const std::string& device_id) OVERRIDE;
|
| +
|
| + virtual void MuteAll() OVERRIDE;
|
| +
|
| + virtual void UnMuteAll() OVERRIDE;
|
| +
|
| + virtual bool IsRecordingInProcess() OVERRIDE;
|
| +
|
| + virtual scoped_refptr<base::MessageLoopProxy> GetMessageLoop() OVERRIDE;
|
| +
|
| + virtual void Init() OVERRIDE;
|
| +
|
| + private:
|
| + virtual ~MockAudioManager();
|
| +
|
| + DISALLOW_COPY_AND_ASSIGN(MockAudioManager);
|
| +};
|
| +
|
| +} // namespace speech
|
| +
|
| +#endif // CONTENT_BROWSER_SPEECH_MOCK_AUDIO_MANAGER_H_
|
|
|