Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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 #ifndef MEDIA_BASE_MOCK_AUDIO_RENDERER_SINK_H_ | 5 #ifndef MEDIA_BASE_MOCK_AUDIO_RENDERER_SINK_H_ |
| 6 #define MEDIA_BASE_MOCK_AUDIO_RENDERER_SINK_H_ | 6 #define MEDIA_BASE_MOCK_AUDIO_RENDERER_SINK_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "media/audio/audio_parameters.h" | 11 #include "media/audio/audio_parameters.h" |
| 12 #include "media/base/audio_renderer_mixer_sink.h" | |
| 12 #include "media/base/audio_renderer_sink.h" | 13 #include "media/base/audio_renderer_sink.h" |
| 13 #include "testing/gmock/include/gmock/gmock.h" | 14 #include "testing/gmock/include/gmock/gmock.h" |
| 14 | 15 |
| 15 namespace media { | 16 namespace media { |
| 16 | 17 |
| 17 class FakeOutputDevice; | 18 class FakeOutputDevice; |
| 18 | 19 |
| 20 // TODO(olka): when RestartableAudioRendererSink is retired, throw this away and | |
| 21 // use MockAudioRendererMixerSink | |
|
Guido Urdaneta
2016/03/08 14:53:09
Is there a crbug for this?
o1ka
2016/04/05 15:13:38
No more MockAudioRendererMixerSink.
| |
| 19 class MockAudioRendererSink : public RestartableAudioRendererSink { | 22 class MockAudioRendererSink : public RestartableAudioRendererSink { |
| 20 public: | 23 public: |
| 21 MockAudioRendererSink(); | 24 MockAudioRendererSink(); |
| 22 explicit MockAudioRendererSink(OutputDeviceStatus device_status); | 25 explicit MockAudioRendererSink(OutputDeviceStatus device_status); |
| 23 | 26 |
| 24 MOCK_METHOD0(Start, void()); | 27 MOCK_METHOD0(Start, void()); |
| 25 MOCK_METHOD0(Stop, void()); | 28 MOCK_METHOD0(Stop, void()); |
| 26 MOCK_METHOD0(Pause, void()); | 29 MOCK_METHOD0(Pause, void()); |
| 27 MOCK_METHOD0(Play, void()); | 30 MOCK_METHOD0(Play, void()); |
| 28 MOCK_METHOD1(SetVolume, bool(double volume)); | 31 MOCK_METHOD1(SetVolume, bool(double volume)); |
| 29 OutputDevice* GetOutputDevice(); | 32 OutputDevice* GetOutputDevice(); |
| 30 | 33 |
| 31 void Initialize(const AudioParameters& params, | 34 void Initialize(const AudioParameters& params, |
| 32 RenderCallback* renderer) override; | 35 RenderCallback* renderer) override; |
| 33 AudioRendererSink::RenderCallback* callback() { return callback_; } | 36 AudioRendererSink::RenderCallback* callback() { return callback_; } |
| 34 | 37 |
| 35 protected: | 38 protected: |
| 36 ~MockAudioRendererSink() override; | 39 ~MockAudioRendererSink() override; |
| 37 | 40 |
| 38 private: | 41 private: |
| 39 RenderCallback* callback_; | 42 RenderCallback* callback_; |
| 40 scoped_ptr<FakeOutputDevice> output_device_; | 43 scoped_ptr<FakeOutputDevice> output_device_; |
| 41 | 44 |
| 42 DISALLOW_COPY_AND_ASSIGN(MockAudioRendererSink); | 45 DISALLOW_COPY_AND_ASSIGN(MockAudioRendererSink); |
| 43 }; | 46 }; |
| 44 | 47 |
| 48 class MockAudioRendererMixerSink : public AudioRendererMixerSink { | |
| 49 public: | |
| 50 MockAudioRendererMixerSink(); | |
| 51 explicit MockAudioRendererMixerSink(OutputDeviceStatus device_status); | |
| 52 MockAudioRendererMixerSink(OutputDeviceStatus device_status, | |
| 53 const AudioParameters& device_output_params); | |
| 54 MockAudioRendererMixerSink(const std::string& device_id, | |
| 55 OutputDeviceStatus device_status); | |
| 56 MockAudioRendererMixerSink(const std::string& device_id, | |
| 57 OutputDeviceStatus device_status, | |
| 58 const AudioParameters& device_output_params); | |
| 59 | |
| 60 MOCK_METHOD0(Start, void()); | |
| 61 MOCK_METHOD0(Stop, void()); | |
| 62 MOCK_METHOD0(Pause, void()); | |
| 63 MOCK_METHOD0(Play, void()); | |
| 64 MOCK_METHOD1(SetVolume, bool(double volume)); | |
| 65 OutputDevice* GetOutputDevice(); | |
| 66 | |
| 67 void Initialize(const AudioParameters& params, | |
| 68 RenderCallback* renderer) override; | |
| 69 | |
| 70 std::string GetDeviceId() override { return device_id_; } | |
| 71 | |
| 72 AudioRendererSink::RenderCallback* callback() { return callback_; } | |
| 73 | |
| 74 protected: | |
| 75 ~MockAudioRendererMixerSink() override; | |
| 76 | |
| 77 private: | |
| 78 RenderCallback* callback_; | |
| 79 scoped_ptr<FakeOutputDevice> output_device_; | |
| 80 const std::string device_id_; | |
| 81 | |
| 82 DISALLOW_COPY_AND_ASSIGN(MockAudioRendererMixerSink); | |
| 83 }; | |
| 84 | |
| 45 } // namespace media | 85 } // namespace media |
| 46 | 86 |
| 47 #endif // MEDIA_BASE_MOCK_AUDIO_RENDERER_SINK_H_ | 87 #endif // MEDIA_BASE_MOCK_AUDIO_RENDERER_SINK_H_ |
| OLD | NEW |