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

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: Fix shutdown. Created 7 years 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
« no previous file with comments | « content/test/webrtc_audio_device_test.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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"
11 #include "base/message_loop/message_loop.h" 11 #include "base/message_loop/message_loop.h"
12 #include "base/run_loop.h" 12 #include "base/run_loop.h"
13 #include "base/synchronization/waitable_event.h" 13 #include "base/synchronization/waitable_event.h"
14 #include "base/test/test_timeouts.h" 14 #include "base/test/test_timeouts.h"
15 #include "content/browser/media/media_internals.h"
15 #include "content/browser/renderer_host/media/audio_input_renderer_host.h" 16 #include "content/browser/renderer_host/media/audio_input_renderer_host.h"
16 #include "content/browser/renderer_host/media/audio_mirroring_manager.h" 17 #include "content/browser/renderer_host/media/audio_mirroring_manager.h"
17 #include "content/browser/renderer_host/media/audio_renderer_host.h" 18 #include "content/browser/renderer_host/media/audio_renderer_host.h"
18 #include "content/browser/renderer_host/media/media_stream_manager.h" 19 #include "content/browser/renderer_host/media/media_stream_manager.h"
19 #include "content/browser/renderer_host/media/mock_media_observer.h" 20 #include "content/browser/renderer_host/media/mock_media_observer.h"
20 #include "content/common/media/media_param_traits.h" 21 #include "content/common/media/media_param_traits.h"
21 #include "content/common/view_messages.h" 22 #include "content/common/view_messages.h"
22 #include "content/public/browser/browser_thread.h" 23 #include "content/public/browser/browser_thread.h"
23 #include "content/public/browser/resource_context.h" 24 #include "content/public/browser/resource_context.h"
24 #include "content/public/common/content_paths.h" 25 #include "content/public/common/content_paths.h"
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after
277 278
278 // Set the current thread as the IO thread. 279 // Set the current thread as the IO thread.
279 io_thread_.reset( 280 io_thread_.reset(
280 new TestBrowserThread(BrowserThread::IO, base::MessageLoop::current())); 281 new TestBrowserThread(BrowserThread::IO, base::MessageLoop::current()));
281 282
282 // Populate our resource context. 283 // Populate our resource context.
283 test_request_context_.reset(new net::TestURLRequestContext()); 284 test_request_context_.reset(new net::TestURLRequestContext());
284 MockRTCResourceContext* resource_context = 285 MockRTCResourceContext* resource_context =
285 static_cast<MockRTCResourceContext*>(resource_context_.get()); 286 static_cast<MockRTCResourceContext*>(resource_context_.get());
286 resource_context->set_request_context(test_request_context_.get()); 287 resource_context->set_request_context(test_request_context_.get());
287 media_internals_.reset(new MockMediaInternals());
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 12 matching lines...) Expand all
310 audio_manager_.reset(); 310 audio_manager_.reset();
311 } 311 }
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(kRenderProcessId,
321 kRenderProcessId, audio_manager_.get(), mirroring_manager_.get(), 321 audio_manager_.get(),
322 media_internals_.get(), media_stream_manager_.get(), channel_.get()); 322 mirroring_manager_.get(),
323 MediaInternals::GetInstance(),
324 media_stream_manager_.get(),
325 channel_.get());
323 audio_render_host_->set_peer_pid_for_testing(base::GetCurrentProcId()); 326 audio_render_host_->set_peer_pid_for_testing(base::GetCurrentProcId());
324 327
325 audio_input_renderer_host_ = 328 audio_input_renderer_host_ =
326 new TestAudioInputRendererHost(audio_manager_.get(), 329 new TestAudioInputRendererHost(audio_manager_.get(),
327 media_stream_manager_.get(), 330 media_stream_manager_.get(),
328 mirroring_manager_.get(), 331 mirroring_manager_.get(),
329 NULL, 332 NULL,
330 channel_.get()); 333 channel_.get());
331 audio_input_renderer_host_->set_peer_pid_for_testing( 334 audio_input_renderer_host_->set_peer_pid_for_testing(
332 base::GetCurrentProcId()); 335 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) { 441 int WebRTCTransportImpl::SendPacket(int channel, const void* data, int len) {
439 return network_->ReceivedRTPPacket(channel, data, len); 442 return network_->ReceivedRTPPacket(channel, data, len);
440 } 443 }
441 444
442 int WebRTCTransportImpl::SendRTCPPacket(int channel, const void* data, 445 int WebRTCTransportImpl::SendRTCPPacket(int channel, const void* data,
443 int len) { 446 int len) {
444 return network_->ReceivedRTCPPacket(channel, data, len); 447 return network_->ReceivedRTCPPacket(channel, data, len);
445 } 448 }
446 449
447 } // namespace content 450 } // namespace content
OLDNEW
« no previous file with comments | « 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