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