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_sink.h" | 12 #include "media/base/audio_renderer_sink.h" |
13 #include "testing/gmock/include/gmock/gmock.h" | 13 #include "testing/gmock/include/gmock/gmock.h" |
14 | 14 |
15 namespace media { | 15 namespace media { |
16 | 16 |
17 class FakeOutputDevice; | 17 class FakeOutputDevice; |
18 | 18 |
19 class MockAudioRendererSink : public RestartableAudioRendererSink { | 19 class MockAudioRendererSink : public SwitchableAudioRendererSink { |
20 public: | 20 public: |
21 class OutputDeviceInfoFactory { | |
22 public: | |
23 virtual OutputDeviceInfo* NewOutputDeviceInfo( | |
Guido Urdaneta
2016/03/22 15:30:18
Why should this return pointers?
Why a factory for
o1ka
2016/03/22 16:13:56
Ok, removing this for now.
| |
24 const std::string& device_id) = 0; | |
25 | |
26 protected: | |
27 virtual ~OutputDeviceInfoFactory() {} | |
28 }; | |
29 | |
21 MockAudioRendererSink(); | 30 MockAudioRendererSink(); |
22 explicit MockAudioRendererSink(OutputDeviceStatus device_status); | 31 explicit MockAudioRendererSink(OutputDeviceStatus device_status); |
32 MockAudioRendererSink(OutputDeviceStatus device_status, | |
33 const AudioParameters& device_output_params); | |
34 MockAudioRendererSink(const std::string& device_id, | |
35 OutputDeviceStatus device_status); | |
36 MockAudioRendererSink(const std::string& device_id, | |
37 OutputDeviceStatus device_status, | |
38 const AudioParameters& device_output_params); | |
39 | |
40 // Use this constructor if you need a working implementation of | |
41 // SwitchOutputDevice(). Do not pass nullptr as |device_factory|. | |
42 MockAudioRendererSink(OutputDeviceInfoFactory* device_info_factory, | |
43 const std::string& device_id); | |
23 | 44 |
24 MOCK_METHOD0(Start, void()); | 45 MOCK_METHOD0(Start, void()); |
25 MOCK_METHOD0(Stop, void()); | 46 MOCK_METHOD0(Stop, void()); |
26 MOCK_METHOD0(Pause, void()); | 47 MOCK_METHOD0(Pause, void()); |
27 MOCK_METHOD0(Play, void()); | 48 MOCK_METHOD0(Play, void()); |
28 MOCK_METHOD1(SetVolume, bool(double volume)); | 49 MOCK_METHOD1(SetVolume, bool(double volume)); |
29 OutputDevice* GetOutputDevice(); | |
30 | 50 |
51 OutputDeviceInfo GetOutputDeviceInfo(); | |
52 | |
53 void SwitchOutputDevice(const std::string& device_id, | |
54 const url::Origin& security_origin, | |
55 const OutputDeviceStatusCB& callback) override; | |
31 void Initialize(const AudioParameters& params, | 56 void Initialize(const AudioParameters& params, |
32 RenderCallback* renderer) override; | 57 RenderCallback* renderer) override; |
33 AudioRendererSink::RenderCallback* callback() { return callback_; } | 58 AudioRendererSink::RenderCallback* callback() { return callback_; } |
34 | 59 |
35 protected: | 60 protected: |
36 ~MockAudioRendererSink() override; | 61 ~MockAudioRendererSink() override; |
37 | 62 |
38 private: | 63 private: |
64 OutputDeviceInfoFactory* device_info_factory_; | |
39 RenderCallback* callback_; | 65 RenderCallback* callback_; |
40 scoped_ptr<FakeOutputDevice> output_device_; | 66 scoped_ptr<OutputDeviceInfo> output_device_info_; |
Guido Urdaneta
2016/03/22 15:30:18
I think this shouldn't be a pointer.
o1ka
2016/03/22 16:13:56
Done.
| |
41 | 67 |
42 DISALLOW_COPY_AND_ASSIGN(MockAudioRendererSink); | 68 DISALLOW_COPY_AND_ASSIGN(MockAudioRendererSink); |
43 }; | 69 }; |
44 | 70 |
45 } // namespace media | 71 } // namespace media |
46 | 72 |
47 #endif // MEDIA_BASE_MOCK_AUDIO_RENDERER_SINK_H_ | 73 #endif // MEDIA_BASE_MOCK_AUDIO_RENDERER_SINK_H_ |
OLD | NEW |