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