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 "content/renderer/media/webrtc_audio_renderer.h" | 5 #include "content/renderer/media/webrtc_audio_renderer.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <utility> | 8 #include <utility> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/bind.h" | 11 #include "base/bind.h" |
12 #include "base/run_loop.h" | 12 #include "base/run_loop.h" |
13 #include "build/build_config.h" | 13 #include "build/build_config.h" |
14 #include "content/public/renderer/media_stream_audio_renderer.h" | 14 #include "content/public/renderer/media_stream_audio_renderer.h" |
15 #include "content/renderer/media/audio_device_factory.h" | 15 #include "content/renderer/media/audio_device_factory.h" |
16 #include "content/renderer/media/webrtc_audio_device_impl.h" | 16 #include "content/renderer/media/webrtc_audio_device_impl.h" |
17 #include "media/base/audio_capturer_source.h" | |
18 #include "media/base/mock_audio_renderer_sink.h" | 17 #include "media/base/mock_audio_renderer_sink.h" |
19 #include "testing/gmock/include/gmock/gmock.h" | 18 #include "testing/gmock/include/gmock/gmock.h" |
20 #include "testing/gtest/include/gtest/gtest.h" | 19 #include "testing/gtest/include/gtest/gtest.h" |
21 #include "third_party/WebKit/public/platform/WebMediaStream.h" | 20 #include "third_party/WebKit/public/platform/WebMediaStream.h" |
22 #include "third_party/WebKit/public/platform/WebMediaStreamTrack.h" | 21 #include "third_party/WebKit/public/platform/WebMediaStreamTrack.h" |
23 #include "third_party/WebKit/public/platform/WebString.h" | |
24 #include "third_party/WebKit/public/web/WebHeap.h" | 22 #include "third_party/WebKit/public/web/WebHeap.h" |
25 #include "third_party/webrtc/api/mediastreaminterface.h" | 23 #include "third_party/webrtc/api/mediastreaminterface.h" |
26 | 24 |
27 using testing::Return; | 25 using testing::Return; |
28 using testing::_; | 26 using testing::_; |
29 | 27 |
30 namespace content { | 28 namespace content { |
31 | 29 |
32 namespace { | 30 namespace { |
33 | 31 |
(...skipping 25 matching lines...) Expand all Loading... |
59 media::OutputDeviceStatus result) { | 57 media::OutputDeviceStatus result) { |
60 MockSwitchDeviceCallback(result); | 58 MockSwitchDeviceCallback(result); |
61 loop->Quit(); | 59 loop->Quit(); |
62 } | 60 } |
63 | 61 |
64 protected: | 62 protected: |
65 WebRtcAudioRendererTest() | 63 WebRtcAudioRendererTest() |
66 : message_loop_(new base::MessageLoopForIO), | 64 : message_loop_(new base::MessageLoopForIO), |
67 source_(new MockAudioRendererSource()) { | 65 source_(new MockAudioRendererSource()) { |
68 blink::WebVector<blink::WebMediaStreamTrack> dummy_tracks; | 66 blink::WebVector<blink::WebMediaStreamTrack> dummy_tracks; |
69 stream_.initialize(blink::WebString::fromUTF8("new stream"), dummy_tracks, | 67 stream_.initialize("new stream", dummy_tracks, dummy_tracks); |
70 dummy_tracks); | |
71 } | 68 } |
72 | 69 |
73 void SetupRenderer(const std::string& device_id) { | 70 void SetupRenderer(const std::string& device_id) { |
74 renderer_ = new WebRtcAudioRenderer(message_loop_->task_runner(), stream_, | 71 renderer_ = new WebRtcAudioRenderer(message_loop_->task_runner(), stream_, |
75 1, 1, device_id, url::Origin()); | 72 1, 1, device_id, url::Origin()); |
76 EXPECT_CALL( | 73 EXPECT_CALL( |
77 *this, MockCreateAudioRendererSink(AudioDeviceFactory::kSourceWebRtc, _, | 74 *this, MockCreateAudioRendererSink(AudioDeviceFactory::kSourceWebRtc, _, |
78 _, device_id, _)); | 75 _, device_id, _)); |
79 EXPECT_TRUE(renderer_->Initialize(source_.get())); | 76 EXPECT_TRUE(renderer_->Initialize(source_.get())); |
80 | 77 |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
272 loop.Run(); | 269 loop.Run(); |
273 EXPECT_EQ(kDefaultOutputDeviceId, | 270 EXPECT_EQ(kDefaultOutputDeviceId, |
274 mock_sink_->GetOutputDeviceInfo().device_id()); | 271 mock_sink_->GetOutputDeviceInfo().device_id()); |
275 | 272 |
276 EXPECT_CALL(*mock_sink_.get(), Stop()); | 273 EXPECT_CALL(*mock_sink_.get(), Stop()); |
277 EXPECT_CALL(*source_.get(), RemoveAudioRenderer(renderer_.get())); | 274 EXPECT_CALL(*source_.get(), RemoveAudioRenderer(renderer_.get())); |
278 renderer_proxy_->Stop(); | 275 renderer_proxy_->Stop(); |
279 } | 276 } |
280 | 277 |
281 } // namespace content | 278 } // namespace content |
OLD | NEW |