| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #include <vector> | 5 #include <vector> |
| 6 | 6 |
| 7 #include "content/renderer/media/audio_device_factory.h" | 7 #include "content/renderer/media/audio_device_factory.h" |
| 8 #include "content/renderer/media/audio_message_filter.h" | 8 #include "content/renderer/media/audio_message_filter.h" |
| 9 #include "content/renderer/media/media_stream_audio_renderer.h" | 9 #include "content/renderer/media/media_stream_audio_renderer.h" |
| 10 #include "content/renderer/media/webrtc/mock_peer_connection_dependency_factory.
h" | 10 #include "content/renderer/media/webrtc/mock_peer_connection_dependency_factory.
h" |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 MockAudioOutputIPC() {} | 32 MockAudioOutputIPC() {} |
| 33 virtual ~MockAudioOutputIPC() {} | 33 virtual ~MockAudioOutputIPC() {} |
| 34 | 34 |
| 35 MOCK_METHOD3(CreateStream, void(media::AudioOutputIPCDelegate* delegate, | 35 MOCK_METHOD3(CreateStream, void(media::AudioOutputIPCDelegate* delegate, |
| 36 const media::AudioParameters& params, | 36 const media::AudioParameters& params, |
| 37 int session_id)); | 37 int session_id)); |
| 38 MOCK_METHOD0(PlayStream, void()); | 38 MOCK_METHOD0(PlayStream, void()); |
| 39 MOCK_METHOD0(PauseStream, void()); | 39 MOCK_METHOD0(PauseStream, void()); |
| 40 MOCK_METHOD0(CloseStream, void()); | 40 MOCK_METHOD0(CloseStream, void()); |
| 41 MOCK_METHOD1(SetVolume, void(double volume)); | 41 MOCK_METHOD1(SetVolume, void(double volume)); |
| 42 MOCK_METHOD4(SwitchDevice, |
| 43 void(const std::string& device_id, |
| 44 const GURL& security_origin, |
| 45 int request_id, |
| 46 const base::Callback<void(int)>& callback)); |
| 42 }; | 47 }; |
| 43 | 48 |
| 44 class FakeAudioOutputDevice | 49 class FakeAudioOutputDevice |
| 45 : NON_EXPORTED_BASE(public media::AudioOutputDevice) { | 50 : NON_EXPORTED_BASE(public media::AudioOutputDevice) { |
| 46 public: | 51 public: |
| 47 FakeAudioOutputDevice( | 52 FakeAudioOutputDevice( |
| 48 scoped_ptr<media::AudioOutputIPC> ipc, | 53 scoped_ptr<media::AudioOutputIPC> ipc, |
| 49 const scoped_refptr<base::SingleThreadTaskRunner>& io_task_runner) | 54 const scoped_refptr<base::SingleThreadTaskRunner>& io_task_runner) |
| 50 : AudioOutputDevice(ipc.Pass(), | 55 : AudioOutputDevice(ipc.Pass(), |
| 51 io_task_runner) {} | 56 io_task_runner) {} |
| 52 MOCK_METHOD0(Start, void()); | 57 MOCK_METHOD0(Start, void()); |
| 53 MOCK_METHOD0(Stop, void()); | 58 MOCK_METHOD0(Stop, void()); |
| 54 MOCK_METHOD0(Pause, void()); | 59 MOCK_METHOD0(Pause, void()); |
| 55 MOCK_METHOD0(Play, void()); | 60 MOCK_METHOD0(Play, void()); |
| 56 MOCK_METHOD1(SetVolume, bool(double volume)); | 61 MOCK_METHOD1(SetVolume, bool(double volume)); |
| 62 MOCK_METHOD3(SwitchOutputDevice, |
| 63 void(const std::string& device_id, |
| 64 const GURL& security_origin, |
| 65 const base::Callback<void(int)>& callback)); |
| 57 | 66 |
| 58 protected: | 67 protected: |
| 59 virtual ~FakeAudioOutputDevice() {} | 68 virtual ~FakeAudioOutputDevice() {} |
| 60 }; | 69 }; |
| 61 | 70 |
| 62 class MockAudioDeviceFactory : public AudioDeviceFactory { | 71 class MockAudioDeviceFactory : public AudioDeviceFactory { |
| 63 public: | 72 public: |
| 64 MockAudioDeviceFactory() {} | 73 MockAudioDeviceFactory() {} |
| 65 virtual ~MockAudioDeviceFactory() {} | 74 virtual ~MockAudioDeviceFactory() {} |
| 66 MOCK_METHOD1(CreateOutputDevice, media::AudioOutputDevice*(int)); | 75 MOCK_METHOD1(CreateOutputDevice, media::AudioOutputDevice*(int)); |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 EXPECT_EQ(kExpectedBufferSize, renderer_->frames_per_buffer()); | 183 EXPECT_EQ(kExpectedBufferSize, renderer_->frames_per_buffer()); |
| 175 EXPECT_EQ(kHardwareSampleRate, renderer_->sample_rate()); | 184 EXPECT_EQ(kHardwareSampleRate, renderer_->sample_rate()); |
| 176 EXPECT_EQ(2, renderer_->channels()); | 185 EXPECT_EQ(2, renderer_->channels()); |
| 177 | 186 |
| 178 EXPECT_CALL(*mock_output_device_.get(), Stop()); | 187 EXPECT_CALL(*mock_output_device_.get(), Stop()); |
| 179 EXPECT_CALL(*source_.get(), RemoveAudioRenderer(renderer_.get())); | 188 EXPECT_CALL(*source_.get(), RemoveAudioRenderer(renderer_.get())); |
| 180 renderer_proxy_->Stop(); | 189 renderer_proxy_->Stop(); |
| 181 } | 190 } |
| 182 | 191 |
| 183 } // namespace content | 192 } // namespace content |
| OLD | NEW |