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

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

Issue 10537121: Adds AudioDevice factory for all audio clients in Chrome (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Removed DVLOGs Created 8 years, 6 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 | 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"
11 #include "base/message_loop.h" 11 #include "base/message_loop.h"
12 #include "base/synchronization/waitable_event.h" 12 #include "base/synchronization/waitable_event.h"
13 #include "base/test/test_timeouts.h" 13 #include "base/test/test_timeouts.h"
14 #include "base/win/scoped_com_initializer.h" 14 #include "base/win/scoped_com_initializer.h"
15 #include "content/browser/renderer_host/media/audio_input_renderer_host.h" 15 #include "content/browser/renderer_host/media/audio_input_renderer_host.h"
16 #include "content/browser/renderer_host/media/audio_renderer_host.h" 16 #include "content/browser/renderer_host/media/audio_renderer_host.h"
17 #include "content/browser/renderer_host/media/media_stream_manager.h" 17 #include "content/browser/renderer_host/media/media_stream_manager.h"
18 #include "content/browser/renderer_host/media/mock_media_observer.h" 18 #include "content/browser/renderer_host/media/mock_media_observer.h"
19 #include "content/common/view_messages.h" 19 #include "content/common/view_messages.h"
20 #include "content/public/browser/browser_thread.h" 20 #include "content/public/browser/browser_thread.h"
21 #include "content/public/common/content_paths.h" 21 #include "content/public/common/content_paths.h"
22 #include "content/public/test/mock_resource_context.h" 22 #include "content/public/test/mock_resource_context.h"
23 #include "content/public/test/test_browser_thread.h" 23 #include "content/public/test/test_browser_thread.h"
24 #include "content/renderer/media/audio_device.h"
25 #include "content/renderer/media/audio_device_factory.h"
24 #include "content/renderer/media/audio_hardware.h" 26 #include "content/renderer/media/audio_hardware.h"
27 #include "content/renderer/media/audio_message_filter.h"
25 #include "content/renderer/media/webrtc_audio_device_impl.h" 28 #include "content/renderer/media/webrtc_audio_device_impl.h"
26 #include "content/renderer/render_process.h" 29 #include "content/renderer/render_process.h"
27 #include "content/renderer/render_thread_impl.h" 30 #include "content/renderer/render_thread_impl.h"
28 #include "content/renderer/renderer_webkitplatformsupport_impl.h" 31 #include "content/renderer/renderer_webkitplatformsupport_impl.h"
29 #include "net/url_request/url_request_test_util.h" 32 #include "net/url_request/url_request_test_util.h"
30 #include "testing/gmock/include/gmock/gmock.h" 33 #include "testing/gmock/include/gmock/gmock.h"
31 #include "testing/gtest/include/gtest/gtest.h" 34 #include "testing/gtest/include/gtest/gtest.h"
32 #include "third_party/webrtc/voice_engine/main/interface/voe_audio_processing.h" 35 #include "third_party/webrtc/voice_engine/main/interface/voe_audio_processing.h"
33 #include "third_party/webrtc/voice_engine/main/interface/voe_base.h" 36 #include "third_party/webrtc/voice_engine/main/interface/voe_base.h"
34 #include "third_party/webrtc/voice_engine/main/interface/voe_file.h" 37 #include "third_party/webrtc/voice_engine/main/interface/voe_file.h"
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 137
135 static const char kThreadName[] = "RenderThread"; 138 static const char kThreadName[] = "RenderThread";
136 ChildProcess::current()->io_message_loop()->PostTask(FROM_HERE, 139 ChildProcess::current()->io_message_loop()->PostTask(FROM_HERE,
137 base::Bind(&WebRTCAudioDeviceTest::InitializeIOThread, 140 base::Bind(&WebRTCAudioDeviceTest::InitializeIOThread,
138 base::Unretained(this), kThreadName)); 141 base::Unretained(this), kThreadName));
139 WaitForIOThreadCompletion(); 142 WaitForIOThreadCompletion();
140 143
141 sandbox_was_enabled_ = 144 sandbox_was_enabled_ =
142 RendererWebKitPlatformSupportImpl::SetSandboxEnabledForTesting(false); 145 RendererWebKitPlatformSupportImpl::SetSandboxEnabledForTesting(false);
143 render_thread_ = new RenderThreadImpl(kThreadName); 146 render_thread_ = new RenderThreadImpl(kThreadName);
147
148 audio_device_factory_.reset(
149 new AudioDeviceFactory<AudioDevice, AudioMessageFilter>(
150 render_thread_->audio_message_filter()));
144 } 151 }
145 152
146 void WebRTCAudioDeviceTest::TearDown() { 153 void WebRTCAudioDeviceTest::TearDown() {
147 SetAudioUtilCallback(NULL); 154 SetAudioUtilCallback(NULL);
148 155
149 // Run any pending cleanup tasks that may have been posted to the main thread. 156 // Run any pending cleanup tasks that may have been posted to the main thread.
150 ChildProcess::current()->main_thread()->message_loop()->RunAllPending(); 157 ChildProcess::current()->main_thread()->message_loop()->RunAllPending();
151 158
152 // Kick of the cleanup process by closing the channel. This queues up 159 // Kick of the cleanup process by closing the channel. This queues up
153 // OnStreamClosed calls to be executed on the audio thread. 160 // OnStreamClosed calls to be executed on the audio thread.
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
354 WebRTCTransportImpl::~WebRTCTransportImpl() {} 361 WebRTCTransportImpl::~WebRTCTransportImpl() {}
355 362
356 int WebRTCTransportImpl::SendPacket(int channel, const void* data, int len) { 363 int WebRTCTransportImpl::SendPacket(int channel, const void* data, int len) {
357 return network_->ReceivedRTPPacket(channel, data, len); 364 return network_->ReceivedRTPPacket(channel, data, len);
358 } 365 }
359 366
360 int WebRTCTransportImpl::SendRTCPPacket(int channel, const void* data, 367 int WebRTCTransportImpl::SendRTCPPacket(int channel, const void* data,
361 int len) { 368 int len) {
362 return network_->ReceivedRTCPPacket(channel, data, len); 369 return network_->ReceivedRTCPPacket(channel, data, len);
363 } 370 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698