Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(417)

Side by Side Diff: media/base/mock_audio_renderer_sink.h

Issue 1809093003: Moving SwitchOutputDevice out of OutputDevice interface, eliminating OutputDevice (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Replace RestartableAudioRendererSink with SwitchableAudioRendererSink in webmediaplayer_impl unit t… Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 FakeOutputDeviceFactory {
22 public:
23 virtual FakeOutputDevice* NewFakeOutputDevice(
24 const std::string& device_id) = 0;
25
26 protected:
27 virtual ~FakeOutputDeviceFactory() {}
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(FakeOutputDeviceFactory* device_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));
50
29 OutputDevice* GetOutputDevice(); 51 OutputDevice* GetOutputDevice();
30 52 void SwitchOutputDevice(const std::string& device_id,
53 const url::Origin& security_origin,
54 const SwitchOutputDeviceCB& callback) override;
31 void Initialize(const AudioParameters& params, 55 void Initialize(const AudioParameters& params,
32 RenderCallback* renderer) override; 56 RenderCallback* renderer) override;
33 AudioRendererSink::RenderCallback* callback() { return callback_; } 57 AudioRendererSink::RenderCallback* callback() { return callback_; }
34 58
35 protected: 59 protected:
36 ~MockAudioRendererSink() override; 60 ~MockAudioRendererSink() override;
37 61
38 private: 62 private:
63 FakeOutputDeviceFactory* device_factory_;
39 RenderCallback* callback_; 64 RenderCallback* callback_;
40 scoped_ptr<FakeOutputDevice> output_device_; 65 scoped_ptr<FakeOutputDevice> output_device_;
41 66
42 DISALLOW_COPY_AND_ASSIGN(MockAudioRendererSink); 67 DISALLOW_COPY_AND_ASSIGN(MockAudioRendererSink);
43 }; 68 };
44 69
45 } // namespace media 70 } // namespace media
46 71
47 #endif // MEDIA_BASE_MOCK_AUDIO_RENDERER_SINK_H_ 72 #endif // MEDIA_BASE_MOCK_AUDIO_RENDERER_SINK_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698