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

Side by Side Diff: content/test/webrtc_audio_device_test.cc

Issue 81953002: Remove MockMediaInternals and incestuous usage. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Polish. Created 7 years, 1 month 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 | Annotate | Revision Log
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 #include "content/test/webrtc_audio_device_test.h" 5 #include "content/test/webrtc_audio_device_test.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "base/file_util.h" 10 #include "base/file_util.h"
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 178
179 DISALLOW_COPY_AND_ASSIGN(MockRTCResourceContext); 179 DISALLOW_COPY_AND_ASSIGN(MockRTCResourceContext);
180 }; 180 };
181 181
182 ACTION_P(QuitMessageLoop, loop_or_proxy) { 182 ACTION_P(QuitMessageLoop, loop_or_proxy) {
183 loop_or_proxy->PostTask(FROM_HERE, base::MessageLoop::QuitClosure()); 183 loop_or_proxy->PostTask(FROM_HERE, base::MessageLoop::QuitClosure());
184 } 184 }
185 185
186 MAYBE_WebRTCAudioDeviceTest::MAYBE_WebRTCAudioDeviceTest() 186 MAYBE_WebRTCAudioDeviceTest::MAYBE_WebRTCAudioDeviceTest()
187 : render_thread_(NULL), audio_hardware_config_(NULL), 187 : render_thread_(NULL), audio_hardware_config_(NULL),
188 has_input_devices_(false), has_output_devices_(false) { 188 has_input_devices_(false), has_output_devices_(false) {
tommi (sloooow) - chröme 2013/11/22 11:55:31 initialize media_internals_
DaleCurtis 2013/11/22 20:33:33 No longer necessary.
189 } 189 }
190 190
191 MAYBE_WebRTCAudioDeviceTest::~MAYBE_WebRTCAudioDeviceTest() {} 191 MAYBE_WebRTCAudioDeviceTest::~MAYBE_WebRTCAudioDeviceTest() {}
192 192
193 void MAYBE_WebRTCAudioDeviceTest::SetUp() { 193 void MAYBE_WebRTCAudioDeviceTest::SetUp() {
194 // This part sets up a RenderThread environment to ensure that 194 // This part sets up a RenderThread environment to ensure that
195 // RenderThread::current() (<=> TLS pointer) is valid. 195 // RenderThread::current() (<=> TLS pointer) is valid.
196 // Main parts are inspired by the RenderViewFakeResourcesTest. 196 // Main parts are inspired by the RenderViewFakeResourcesTest.
197 // Note that, the IPC part is not utilized in this test. 197 // Note that, the IPC part is not utilized in this test.
198 saved_content_renderer_.reset( 198 saved_content_renderer_.reset(
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
277 277
278 // Set the current thread as the IO thread. 278 // Set the current thread as the IO thread.
279 io_thread_.reset( 279 io_thread_.reset(
280 new TestBrowserThread(BrowserThread::IO, base::MessageLoop::current())); 280 new TestBrowserThread(BrowserThread::IO, base::MessageLoop::current()));
281 281
282 // Populate our resource context. 282 // Populate our resource context.
283 test_request_context_.reset(new net::TestURLRequestContext()); 283 test_request_context_.reset(new net::TestURLRequestContext());
284 MockRTCResourceContext* resource_context = 284 MockRTCResourceContext* resource_context =
285 static_cast<MockRTCResourceContext*>(resource_context_.get()); 285 static_cast<MockRTCResourceContext*>(resource_context_.get());
286 resource_context->set_request_context(test_request_context_.get()); 286 resource_context->set_request_context(test_request_context_.get());
287 media_internals_.reset(new MockMediaInternals()); 287 media_internals_ = MediaInternals::GetInstance();
288 288
289 // Create our own AudioManager, AudioMirroringManager and MediaStreamManager. 289 // Create our own AudioManager, AudioMirroringManager and MediaStreamManager.
290 audio_manager_.reset(media::AudioManager::Create()); 290 audio_manager_.reset(media::AudioManager::Create());
291 mirroring_manager_.reset(new AudioMirroringManager()); 291 mirroring_manager_.reset(new AudioMirroringManager());
292 media_stream_manager_.reset(new MediaStreamManager(audio_manager_.get())); 292 media_stream_manager_.reset(new MediaStreamManager(audio_manager_.get()));
293 293
294 has_input_devices_ = audio_manager_->HasAudioInputDevices(); 294 has_input_devices_ = audio_manager_->HasAudioInputDevices();
295 has_output_devices_ = audio_manager_->HasAudioOutputDevices(); 295 has_output_devices_ = audio_manager_->HasAudioOutputDevices();
296 296
297 // Create an IPC channel that handles incoming messages on the IO thread. 297 // Create an IPC channel that handles incoming messages on the IO thread.
(...skipping 14 matching lines...) Expand all
312 312
313 void MAYBE_WebRTCAudioDeviceTest::CreateChannel(const char* name) { 313 void MAYBE_WebRTCAudioDeviceTest::CreateChannel(const char* name) {
314 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 314 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
315 315
316 channel_.reset(new IPC::Channel(name, IPC::Channel::MODE_SERVER, this)); 316 channel_.reset(new IPC::Channel(name, IPC::Channel::MODE_SERVER, this));
317 ASSERT_TRUE(channel_->Connect()); 317 ASSERT_TRUE(channel_->Connect());
318 318
319 static const int kRenderProcessId = 1; 319 static const int kRenderProcessId = 1;
320 audio_render_host_ = new TestAudioRendererHost( 320 audio_render_host_ = new TestAudioRendererHost(
321 kRenderProcessId, audio_manager_.get(), mirroring_manager_.get(), 321 kRenderProcessId, audio_manager_.get(), mirroring_manager_.get(),
322 media_internals_.get(), media_stream_manager_.get(), channel_.get()); 322 media_internals_, media_stream_manager_.get(), channel_.get());
acolwell GONE FROM CHROMIUM 2013/11/22 19:12:48 This appears to be the only use of media_internals
DaleCurtis 2013/11/22 20:33:33 Done.
323 audio_render_host_->set_peer_pid_for_testing(base::GetCurrentProcId()); 323 audio_render_host_->set_peer_pid_for_testing(base::GetCurrentProcId());
324 324
325 audio_input_renderer_host_ = 325 audio_input_renderer_host_ =
326 new TestAudioInputRendererHost(audio_manager_.get(), 326 new TestAudioInputRendererHost(audio_manager_.get(),
327 media_stream_manager_.get(), 327 media_stream_manager_.get(),
328 mirroring_manager_.get(), 328 mirroring_manager_.get(),
329 NULL, 329 NULL,
330 channel_.get()); 330 channel_.get());
331 audio_input_renderer_host_->set_peer_pid_for_testing( 331 audio_input_renderer_host_->set_peer_pid_for_testing(
332 base::GetCurrentProcId()); 332 base::GetCurrentProcId());
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
438 int WebRTCTransportImpl::SendPacket(int channel, const void* data, int len) { 438 int WebRTCTransportImpl::SendPacket(int channel, const void* data, int len) {
439 return network_->ReceivedRTPPacket(channel, data, len); 439 return network_->ReceivedRTPPacket(channel, data, len);
440 } 440 }
441 441
442 int WebRTCTransportImpl::SendRTCPPacket(int channel, const void* data, 442 int WebRTCTransportImpl::SendRTCPPacket(int channel, const void* data,
443 int len) { 443 int len) {
444 return network_->ReceivedRTCPPacket(channel, data, len); 444 return network_->ReceivedRTCPPacket(channel, data, len);
445 } 445 }
446 446
447 } // namespace content 447 } // namespace content
OLDNEW
« content/test/webrtc_audio_device_test.h ('K') | « content/test/webrtc_audio_device_test.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698