Chromium Code Reviews| Index: media/base/mock_audio_renderer_sink.cc |
| diff --git a/media/base/mock_audio_renderer_sink.cc b/media/base/mock_audio_renderer_sink.cc |
| index 79653b2f8232c2b0688a9ec95232101495530d9b..4785f5c3ac87d62d7f9d4dbaf42f1871dd96b5cc 100644 |
| --- a/media/base/mock_audio_renderer_sink.cc |
| +++ b/media/base/mock_audio_renderer_sink.cc |
| @@ -3,24 +3,63 @@ |
| // found in the LICENSE file. |
| #include "media/base/mock_audio_renderer_sink.h" |
| -#include "media/base/fake_output_device.h" |
| namespace media { |
| MockAudioRendererSink::MockAudioRendererSink() |
| : MockAudioRendererSink(OUTPUT_DEVICE_STATUS_OK) {} |
| MockAudioRendererSink::MockAudioRendererSink(OutputDeviceStatus device_status) |
| - : output_device_(new FakeOutputDevice(device_status)) {} |
| + : MockAudioRendererSink(std::string(), device_status) {} |
| + |
| +MockAudioRendererSink::MockAudioRendererSink(const std::string& device_id, |
| + OutputDeviceStatus device_status) |
| + : MockAudioRendererSink( |
| + device_id, |
| + device_status, |
| + media::AudioParameters(media::AudioParameters::AUDIO_FAKE, |
| + media::CHANNEL_LAYOUT_STEREO, |
| + media::AudioParameters::kTelephoneSampleRate, |
| + 16, |
| + 1)) {} |
| + |
| +MockAudioRendererSink::MockAudioRendererSink( |
| + const std::string& device_id, |
| + OutputDeviceStatus device_status, |
| + const AudioParameters& device_output_params) |
| + : device_info_factory_(nullptr), |
| + output_device_info_(new OutputDeviceInfo(device_id, |
| + device_status, |
| + device_output_params)) {} |
| + |
| +MockAudioRendererSink::MockAudioRendererSink( |
| + OutputDeviceInfoFactory* device_info_factory, |
| + const std::string& device_id) |
| + : device_info_factory_(device_info_factory), |
| + output_device_info_( |
| + device_info_factory_->NewOutputDeviceInfo(device_id)) {} |
| MockAudioRendererSink::~MockAudioRendererSink() {} |
| +void MockAudioRendererSink::SwitchOutputDevice( |
| + const std::string& device_id, |
| + const url::Origin& security_origin, |
| + const OutputDeviceStatusCB& callback) { |
| + // NB: output device won't be changed if no factory is provided at |
|
Guido Urdaneta
2016/03/22 15:30:18
Isn't it a lot simpler to just store the device_id
o1ka
2016/03/22 16:13:56
It looks cool! :) But I removed it, since it's not
|
| + // construction time. |
| + if (device_info_factory_) { |
| + output_device_info_.reset( |
| + device_info_factory_->NewOutputDeviceInfo(device_id)); |
| + } |
| + callback.Run(output_device_info_->device_status()); |
| +} |
| + |
| void MockAudioRendererSink::Initialize(const AudioParameters& params, |
| RenderCallback* renderer) { |
| callback_ = renderer; |
| } |
| -OutputDevice* MockAudioRendererSink::GetOutputDevice() { |
| - return output_device_.get(); |
| +OutputDeviceInfo MockAudioRendererSink::GetOutputDeviceInfo() { |
| + return *output_device_info_; |
| } |
| } // namespace media |