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

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

Issue 66183002: Replace MessageLoopProxy with SingleThreadTaskRunner for the rest of media/. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix win and audio tests Created 6 years, 11 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
« no previous file with comments | « content/test/webrtc_audio_device_test.h ('k') | media/audio/alsa/alsa_output.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/message_loop.h"
12 #include "base/run_loop.h" 11 #include "base/run_loop.h"
13 #include "base/synchronization/waitable_event.h" 12 #include "base/synchronization/waitable_event.h"
14 #include "base/test/test_timeouts.h" 13 #include "base/test/test_timeouts.h"
15 #include "content/browser/media/media_internals.h" 14 #include "content/browser/media/media_internals.h"
16 #include "content/browser/renderer_host/media/audio_input_renderer_host.h" 15 #include "content/browser/renderer_host/media/audio_input_renderer_host.h"
17 #include "content/browser/renderer_host/media/audio_mirroring_manager.h" 16 #include "content/browser/renderer_host/media/audio_mirroring_manager.h"
18 #include "content/browser/renderer_host/media/audio_renderer_host.h" 17 #include "content/browser/renderer_host/media/audio_renderer_host.h"
19 #include "content/browser/renderer_host/media/media_stream_manager.h" 18 #include "content/browser/renderer_host/media/media_stream_manager.h"
20 #include "content/browser/renderer_host/media/mock_media_observer.h" 19 #include "content/browser/renderer_host/media/mock_media_observer.h"
21 #include "content/common/media/media_param_traits.h" 20 #include "content/common/media/media_param_traits.h"
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after
392 IPC_MESSAGE_UNHANDLED(handled = false) 391 IPC_MESSAGE_UNHANDLED(handled = false)
393 IPC_END_MESSAGE_MAP_EX() 392 IPC_END_MESSAGE_MAP_EX()
394 393
395 EXPECT_TRUE(message_is_ok); 394 EXPECT_TRUE(message_is_ok);
396 395
397 return true; 396 return true;
398 } 397 }
399 398
400 // Posts a final task to the IO message loop and waits for completion. 399 // Posts a final task to the IO message loop and waits for completion.
401 void MAYBE_WebRTCAudioDeviceTest::WaitForIOThreadCompletion() { 400 void MAYBE_WebRTCAudioDeviceTest::WaitForIOThreadCompletion() {
402 WaitForMessageLoopCompletion( 401 WaitForTaskRunnerCompletion(
403 ChildProcess::current()->io_message_loop()->message_loop_proxy().get()); 402 ChildProcess::current()->io_message_loop()->message_loop_proxy());
404 } 403 }
405 404
406 void MAYBE_WebRTCAudioDeviceTest::WaitForAudioManagerCompletion() { 405 void MAYBE_WebRTCAudioDeviceTest::WaitForAudioManagerCompletion() {
407 if (audio_manager_) 406 if (audio_manager_)
408 WaitForMessageLoopCompletion(audio_manager_->GetMessageLoop().get()); 407 WaitForTaskRunnerCompletion(audio_manager_->GetTaskRunner());
409 } 408 }
410 409
411 void MAYBE_WebRTCAudioDeviceTest::WaitForMessageLoopCompletion( 410 void MAYBE_WebRTCAudioDeviceTest::WaitForTaskRunnerCompletion(
412 base::MessageLoopProxy* loop) { 411 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner) {
413 base::WaitableEvent* event = new base::WaitableEvent(false, false); 412 base::WaitableEvent* event = new base::WaitableEvent(false, false);
414 loop->PostTask(FROM_HERE, base::Bind(&base::WaitableEvent::Signal, 413 task_runner->PostTask(
415 base::Unretained(event))); 414 FROM_HERE,
415 base::Bind(&base::WaitableEvent::Signal, base::Unretained(event)));
416 if (event->TimedWait(TestTimeouts::action_max_timeout())) { 416 if (event->TimedWait(TestTimeouts::action_max_timeout())) {
417 delete event; 417 delete event;
418 } else { 418 } else {
419 // Don't delete the event object in case the message ever gets processed. 419 // Don't delete the event object in case the message ever gets processed.
420 // If we do, we will crash the test process. 420 // If we do, we will crash the test process.
421 ADD_FAILURE() << "Failed to wait for message loop"; 421 ADD_FAILURE() << "Failed to wait for message loop";
422 } 422 }
423 } 423 }
424 424
425 std::string MAYBE_WebRTCAudioDeviceTest::GetTestDataPath( 425 std::string MAYBE_WebRTCAudioDeviceTest::GetTestDataPath(
(...skipping 18 matching lines...) Expand all
444 int WebRTCTransportImpl::SendPacket(int channel, const void* data, int len) { 444 int WebRTCTransportImpl::SendPacket(int channel, const void* data, int len) {
445 return network_->ReceivedRTPPacket(channel, data, len); 445 return network_->ReceivedRTPPacket(channel, data, len);
446 } 446 }
447 447
448 int WebRTCTransportImpl::SendRTCPPacket(int channel, const void* data, 448 int WebRTCTransportImpl::SendRTCPPacket(int channel, const void* data,
449 int len) { 449 int len) {
450 return network_->ReceivedRTCPPacket(channel, data, len); 450 return network_->ReceivedRTCPPacket(channel, data, len);
451 } 451 }
452 452
453 } // namespace content 453 } // namespace content
OLDNEW
« no previous file with comments | « content/test/webrtc_audio_device_test.h ('k') | media/audio/alsa/alsa_output.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698