| 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 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 278 IPC::ChannelProxy::MessageFilter* filter = | 278 IPC::ChannelProxy::MessageFilter* filter = |
| 279 render_thread_->audio_input_message_filter(); | 279 render_thread_->audio_input_message_filter(); |
| 280 if (filter->OnMessageReceived(message)) | 280 if (filter->OnMessageReceived(message)) |
| 281 return true; | 281 return true; |
| 282 | 282 |
| 283 filter = render_thread_->audio_message_filter(); | 283 filter = render_thread_->audio_message_filter(); |
| 284 if (filter->OnMessageReceived(message)) | 284 if (filter->OnMessageReceived(message)) |
| 285 return true; | 285 return true; |
| 286 } | 286 } |
| 287 | 287 |
| 288 if (audio_render_host_.get()) { | 288 if (audio_render_host_) { |
| 289 bool message_was_ok = false; | 289 bool message_was_ok = false; |
| 290 if (audio_render_host_->OnMessageReceived(message, &message_was_ok)) | 290 if (audio_render_host_->OnMessageReceived(message, &message_was_ok)) |
| 291 return true; | 291 return true; |
| 292 } | 292 } |
| 293 | 293 |
| 294 if (audio_input_renderer_host_.get()) { | 294 if (audio_input_renderer_host_) { |
| 295 bool message_was_ok = false; | 295 bool message_was_ok = false; |
| 296 if (audio_input_renderer_host_->OnMessageReceived(message, &message_was_ok)) | 296 if (audio_input_renderer_host_->OnMessageReceived(message, &message_was_ok)) |
| 297 return true; | 297 return true; |
| 298 } | 298 } |
| 299 | 299 |
| 300 bool handled ALLOW_UNUSED = true; | 300 bool handled ALLOW_UNUSED = true; |
| 301 bool message_is_ok = true; | 301 bool message_is_ok = true; |
| 302 IPC_BEGIN_MESSAGE_MAP_EX(WebRTCAudioDeviceTest, message, message_is_ok) | 302 IPC_BEGIN_MESSAGE_MAP_EX(WebRTCAudioDeviceTest, message, message_is_ok) |
| 303 IPC_MESSAGE_HANDLER(ViewHostMsg_GetAudioHardwareConfig, | 303 IPC_MESSAGE_HANDLER(ViewHostMsg_GetAudioHardwareConfig, |
| 304 OnGetAudioHardwareConfig) | 304 OnGetAudioHardwareConfig) |
| 305 IPC_MESSAGE_UNHANDLED(handled = false) | 305 IPC_MESSAGE_UNHANDLED(handled = false) |
| 306 IPC_END_MESSAGE_MAP_EX() | 306 IPC_END_MESSAGE_MAP_EX() |
| 307 | 307 |
| 308 EXPECT_TRUE(message_is_ok); | 308 EXPECT_TRUE(message_is_ok); |
| 309 | 309 |
| 310 return true; | 310 return true; |
| 311 } | 311 } |
| 312 | 312 |
| 313 // Posts a final task to the IO message loop and waits for completion. | 313 // Posts a final task to the IO message loop and waits for completion. |
| 314 void WebRTCAudioDeviceTest::WaitForIOThreadCompletion() { | 314 void WebRTCAudioDeviceTest::WaitForIOThreadCompletion() { |
| 315 WaitForMessageLoopCompletion( | 315 WaitForMessageLoopCompletion( |
| 316 ChildProcess::current()->io_message_loop()->message_loop_proxy()); | 316 ChildProcess::current()->io_message_loop()->message_loop_proxy()); |
| 317 } | 317 } |
| 318 | 318 |
| 319 void WebRTCAudioDeviceTest::WaitForAudioManagerCompletion() { | 319 void WebRTCAudioDeviceTest::WaitForAudioManagerCompletion() { |
| 320 if (audio_manager_.get()) | 320 if (audio_manager_) |
| 321 WaitForMessageLoopCompletion(audio_manager_->GetMessageLoop()); | 321 WaitForMessageLoopCompletion(audio_manager_->GetMessageLoop()); |
| 322 } | 322 } |
| 323 | 323 |
| 324 void WebRTCAudioDeviceTest::WaitForMessageLoopCompletion( | 324 void WebRTCAudioDeviceTest::WaitForMessageLoopCompletion( |
| 325 base::MessageLoopProxy* loop) { | 325 base::MessageLoopProxy* loop) { |
| 326 base::WaitableEvent* event = new base::WaitableEvent(false, false); | 326 base::WaitableEvent* event = new base::WaitableEvent(false, false); |
| 327 loop->PostTask(FROM_HERE, base::Bind(&base::WaitableEvent::Signal, | 327 loop->PostTask(FROM_HERE, base::Bind(&base::WaitableEvent::Signal, |
| 328 base::Unretained(event))); | 328 base::Unretained(event))); |
| 329 if (event->TimedWait(TestTimeouts::action_max_timeout())) { | 329 if (event->TimedWait(TestTimeouts::action_max_timeout())) { |
| 330 delete event; | 330 delete event; |
| (...skipping 26 matching lines...) Expand all Loading... |
| 357 int WebRTCTransportImpl::SendPacket(int channel, const void* data, int len) { | 357 int WebRTCTransportImpl::SendPacket(int channel, const void* data, int len) { |
| 358 return network_->ReceivedRTPPacket(channel, data, len); | 358 return network_->ReceivedRTPPacket(channel, data, len); |
| 359 } | 359 } |
| 360 | 360 |
| 361 int WebRTCTransportImpl::SendRTCPPacket(int channel, const void* data, | 361 int WebRTCTransportImpl::SendRTCPPacket(int channel, const void* data, |
| 362 int len) { | 362 int len) { |
| 363 return network_->ReceivedRTCPPacket(channel, data, len); | 363 return network_->ReceivedRTCPPacket(channel, data, len); |
| 364 } | 364 } |
| 365 | 365 |
| 366 } // namespace content | 366 } // namespace content |
| OLD | NEW |