OLD | NEW |
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 22 matching lines...) Expand all Loading... |
33 #include "testing/gtest/include/gtest/gtest.h" | 33 #include "testing/gtest/include/gtest/gtest.h" |
34 #include "third_party/webrtc/voice_engine/include/voe_audio_processing.h" | 34 #include "third_party/webrtc/voice_engine/include/voe_audio_processing.h" |
35 #include "third_party/webrtc/voice_engine/include/voe_base.h" | 35 #include "third_party/webrtc/voice_engine/include/voe_base.h" |
36 #include "third_party/webrtc/voice_engine/include/voe_file.h" | 36 #include "third_party/webrtc/voice_engine/include/voe_file.h" |
37 #include "third_party/webrtc/voice_engine/include/voe_network.h" | 37 #include "third_party/webrtc/voice_engine/include/voe_network.h" |
38 | 38 |
39 #if defined(OS_WIN) | 39 #if defined(OS_WIN) |
40 #include "base/win/scoped_com_initializer.h" | 40 #include "base/win/scoped_com_initializer.h" |
41 #endif | 41 #endif |
42 | 42 |
| 43 #if defined(OS_ANDROID) |
| 44 #include "base/android/jni_android.h" |
| 45 #include "media/audio/audio_manager_base.h" |
| 46 #endif |
| 47 |
43 using testing::_; | 48 using testing::_; |
44 using testing::InvokeWithoutArgs; | 49 using testing::InvokeWithoutArgs; |
45 using testing::Return; | 50 using testing::Return; |
46 using testing::StrEq; | 51 using testing::StrEq; |
47 | 52 |
48 namespace content { | 53 namespace content { |
49 | 54 |
50 // This class is a mock of the child process singleton which is needed | 55 // This class is a mock of the child process singleton which is needed |
51 // to be able to create a RenderThread object. | 56 // to be able to create a RenderThread object. |
52 class WebRTCMockRenderProcess : public RenderProcess { | 57 class WebRTCMockRenderProcess : public RenderProcess { |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 } | 122 } |
118 | 123 |
119 WebRTCAudioDeviceTest::WebRTCAudioDeviceTest() | 124 WebRTCAudioDeviceTest::WebRTCAudioDeviceTest() |
120 : render_thread_(NULL), audio_hardware_config_(NULL), | 125 : render_thread_(NULL), audio_hardware_config_(NULL), |
121 has_input_devices_(false), has_output_devices_(false) { | 126 has_input_devices_(false), has_output_devices_(false) { |
122 } | 127 } |
123 | 128 |
124 WebRTCAudioDeviceTest::~WebRTCAudioDeviceTest() {} | 129 WebRTCAudioDeviceTest::~WebRTCAudioDeviceTest() {} |
125 | 130 |
126 void WebRTCAudioDeviceTest::SetUp() { | 131 void WebRTCAudioDeviceTest::SetUp() { |
| 132 #if defined(OS_ANDROID) |
| 133 media::AudioManagerBase::RegisterAudioManager( |
| 134 base::android::AttachCurrentThread()); |
| 135 #endif |
| 136 |
127 // This part sets up a RenderThread environment to ensure that | 137 // This part sets up a RenderThread environment to ensure that |
128 // RenderThread::current() (<=> TLS pointer) is valid. | 138 // RenderThread::current() (<=> TLS pointer) is valid. |
129 // Main parts are inspired by the RenderViewFakeResourcesTest. | 139 // Main parts are inspired by the RenderViewFakeResourcesTest. |
130 // Note that, the IPC part is not utilized in this test. | 140 // Note that, the IPC part is not utilized in this test. |
131 saved_content_renderer_.reset( | 141 saved_content_renderer_.reset( |
132 new ReplaceContentClientRenderer(&content_renderer_client_)); | 142 new ReplaceContentClientRenderer(&content_renderer_client_)); |
133 mock_process_.reset(new WebRTCMockRenderProcess()); | 143 mock_process_.reset(new WebRTCMockRenderProcess()); |
134 ui_thread_.reset(new TestBrowserThread(BrowserThread::UI, | 144 ui_thread_.reset(new TestBrowserThread(BrowserThread::UI, |
135 MessageLoop::current())); | 145 MessageLoop::current())); |
136 | 146 |
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
359 int WebRTCTransportImpl::SendPacket(int channel, const void* data, int len) { | 369 int WebRTCTransportImpl::SendPacket(int channel, const void* data, int len) { |
360 return network_->ReceivedRTPPacket(channel, data, len); | 370 return network_->ReceivedRTPPacket(channel, data, len); |
361 } | 371 } |
362 | 372 |
363 int WebRTCTransportImpl::SendRTCPPacket(int channel, const void* data, | 373 int WebRTCTransportImpl::SendRTCPPacket(int channel, const void* data, |
364 int len) { | 374 int len) { |
365 return network_->ReceivedRTCPPacket(channel, data, len); | 375 return network_->ReceivedRTCPPacket(channel, data, len); |
366 } | 376 } |
367 | 377 |
368 } // namespace content | 378 } // namespace content |
OLD | NEW |