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

Side by Side Diff: content/renderer/media/webrtc_audio_renderer_unittest.cc

Issue 1834323002: MediaStream audio: Refactor 3 separate "glue" implementations into one. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: REBASE + Workaround to ensure MediaStreamAudioProcessor is destroyed on the main thread. Created 4 years, 7 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 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"
17 #include "media/base/mock_audio_renderer_sink.h" 18 #include "media/base/mock_audio_renderer_sink.h"
18 #include "testing/gmock/include/gmock/gmock.h" 19 #include "testing/gmock/include/gmock/gmock.h"
19 #include "testing/gtest/include/gtest/gtest.h" 20 #include "testing/gtest/include/gtest/gtest.h"
20 #include "third_party/WebKit/public/platform/WebMediaStream.h" 21 #include "third_party/WebKit/public/platform/WebMediaStream.h"
21 #include "third_party/WebKit/public/platform/WebMediaStreamTrack.h" 22 #include "third_party/WebKit/public/platform/WebMediaStreamTrack.h"
23 #include "third_party/WebKit/public/platform/WebString.h"
22 #include "third_party/WebKit/public/web/WebHeap.h" 24 #include "third_party/WebKit/public/web/WebHeap.h"
23 #include "third_party/webrtc/api/mediastreaminterface.h" 25 #include "third_party/webrtc/api/mediastreaminterface.h"
24 26
25 using testing::Return; 27 using testing::Return;
26 using testing::_; 28 using testing::_;
27 29
28 namespace content { 30 namespace content {
29 31
30 namespace { 32 namespace {
31 33
(...skipping 25 matching lines...) Expand all
57 media::OutputDeviceStatus result) { 59 media::OutputDeviceStatus result) {
58 MockSwitchDeviceCallback(result); 60 MockSwitchDeviceCallback(result);
59 loop->Quit(); 61 loop->Quit();
60 } 62 }
61 63
62 protected: 64 protected:
63 WebRtcAudioRendererTest() 65 WebRtcAudioRendererTest()
64 : message_loop_(new base::MessageLoopForIO), 66 : message_loop_(new base::MessageLoopForIO),
65 source_(new MockAudioRendererSource()) { 67 source_(new MockAudioRendererSource()) {
66 blink::WebVector<blink::WebMediaStreamTrack> dummy_tracks; 68 blink::WebVector<blink::WebMediaStreamTrack> dummy_tracks;
67 stream_.initialize("new stream", dummy_tracks, dummy_tracks); 69 stream_.initialize(blink::WebString::fromUTF8("new stream"), dummy_tracks,
70 dummy_tracks);
68 } 71 }
69 72
70 void SetupRenderer(const std::string& device_id) { 73 void SetupRenderer(const std::string& device_id) {
71 renderer_ = new WebRtcAudioRenderer(message_loop_->task_runner(), stream_, 74 renderer_ = new WebRtcAudioRenderer(message_loop_->task_runner(), stream_,
72 1, 1, device_id, url::Origin()); 75 1, 1, device_id, url::Origin());
73 EXPECT_CALL( 76 EXPECT_CALL(
74 *this, MockCreateAudioRendererSink(AudioDeviceFactory::kSourceWebRtc, _, 77 *this, MockCreateAudioRendererSink(AudioDeviceFactory::kSourceWebRtc, _,
75 _, device_id, _)); 78 _, device_id, _));
76 EXPECT_TRUE(renderer_->Initialize(source_.get())); 79 EXPECT_TRUE(renderer_->Initialize(source_.get()));
77 80
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
269 loop.Run(); 272 loop.Run();
270 EXPECT_EQ(kDefaultOutputDeviceId, 273 EXPECT_EQ(kDefaultOutputDeviceId,
271 mock_sink_->GetOutputDeviceInfo().device_id()); 274 mock_sink_->GetOutputDeviceInfo().device_id());
272 275
273 EXPECT_CALL(*mock_sink_.get(), Stop()); 276 EXPECT_CALL(*mock_sink_.get(), Stop());
274 EXPECT_CALL(*source_.get(), RemoveAudioRenderer(renderer_.get())); 277 EXPECT_CALL(*source_.get(), RemoveAudioRenderer(renderer_.get()));
275 renderer_proxy_->Stop(); 278 renderer_proxy_->Stop();
276 } 279 }
277 280
278 } // namespace content 281 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/media/webrtc_audio_renderer.cc ('k') | content/renderer/media/webrtc_local_audio_source_provider.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698