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

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

Issue 12911007: Add speaker on/off control on Android for WebRTC (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 7 years, 9 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"
(...skipping 24 matching lines...) Expand all
35 #include "testing/gtest/include/gtest/gtest.h" 35 #include "testing/gtest/include/gtest/gtest.h"
36 #include "third_party/webrtc/voice_engine/include/voe_audio_processing.h" 36 #include "third_party/webrtc/voice_engine/include/voe_audio_processing.h"
37 #include "third_party/webrtc/voice_engine/include/voe_base.h" 37 #include "third_party/webrtc/voice_engine/include/voe_base.h"
38 #include "third_party/webrtc/voice_engine/include/voe_file.h" 38 #include "third_party/webrtc/voice_engine/include/voe_file.h"
39 #include "third_party/webrtc/voice_engine/include/voe_network.h" 39 #include "third_party/webrtc/voice_engine/include/voe_network.h"
40 40
41 #if defined(OS_WIN) 41 #if defined(OS_WIN)
42 #include "base/win/scoped_com_initializer.h" 42 #include "base/win/scoped_com_initializer.h"
43 #endif 43 #endif
44 44
45 #if defined(OS_ANDROID)
46 #include "base/android/jni_android.h"
47 #include "media/audio/audio_manager_base.h"
48 #endif
49
45 using media::AudioParameters; 50 using media::AudioParameters;
46 using media::ChannelLayout; 51 using media::ChannelLayout;
47 using testing::_; 52 using testing::_;
48 using testing::InvokeWithoutArgs; 53 using testing::InvokeWithoutArgs;
49 using testing::Return; 54 using testing::Return;
50 using testing::StrEq; 55 using testing::StrEq;
51 56
52 namespace content { 57 namespace content {
53 58
54 // This class is a mock of the child process singleton which is needed 59 // This class is a mock of the child process singleton which is needed
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 } 126 }
122 127
123 WebRTCAudioDeviceTest::WebRTCAudioDeviceTest() 128 WebRTCAudioDeviceTest::WebRTCAudioDeviceTest()
124 : render_thread_(NULL), audio_hardware_config_(NULL), 129 : render_thread_(NULL), audio_hardware_config_(NULL),
125 has_input_devices_(false), has_output_devices_(false) { 130 has_input_devices_(false), has_output_devices_(false) {
126 } 131 }
127 132
128 WebRTCAudioDeviceTest::~WebRTCAudioDeviceTest() {} 133 WebRTCAudioDeviceTest::~WebRTCAudioDeviceTest() {}
129 134
130 void WebRTCAudioDeviceTest::SetUp() { 135 void WebRTCAudioDeviceTest::SetUp() {
136 #if defined(OS_ANDROID)
137 media::AudioManagerBase::RegisterAudioManager(
138 base::android::AttachCurrentThread());
139 #endif
140
131 // This part sets up a RenderThread environment to ensure that 141 // This part sets up a RenderThread environment to ensure that
132 // RenderThread::current() (<=> TLS pointer) is valid. 142 // RenderThread::current() (<=> TLS pointer) is valid.
133 // Main parts are inspired by the RenderViewFakeResourcesTest. 143 // Main parts are inspired by the RenderViewFakeResourcesTest.
134 // Note that, the IPC part is not utilized in this test. 144 // Note that, the IPC part is not utilized in this test.
135 saved_content_renderer_.reset( 145 saved_content_renderer_.reset(
136 new ReplaceContentClientRenderer(&content_renderer_client_)); 146 new ReplaceContentClientRenderer(&content_renderer_client_));
137 mock_process_.reset(new WebRTCMockRenderProcess()); 147 mock_process_.reset(new WebRTCMockRenderProcess());
138 ui_thread_.reset(new TestBrowserThread(BrowserThread::UI, 148 ui_thread_.reset(new TestBrowserThread(BrowserThread::UI,
139 MessageLoop::current())); 149 MessageLoop::current()));
140 150
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
357 int WebRTCTransportImpl::SendPacket(int channel, const void* data, int len) { 367 int WebRTCTransportImpl::SendPacket(int channel, const void* data, int len) {
358 return network_->ReceivedRTPPacket(channel, data, len); 368 return network_->ReceivedRTPPacket(channel, data, len);
359 } 369 }
360 370
361 int WebRTCTransportImpl::SendRTCPPacket(int channel, const void* data, 371 int WebRTCTransportImpl::SendRTCPPacket(int channel, const void* data,
362 int len) { 372 int len) {
363 return network_->ReceivedRTCPPacket(channel, data, len); 373 return network_->ReceivedRTCPPacket(channel, data, len);
364 } 374 }
365 375
366 } // namespace content 376 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698