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

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: Created 7 years, 1 month 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"
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/renderer_host/media/audio_input_renderer_host.h" 14 #include "content/browser/renderer_host/media/audio_input_renderer_host.h"
16 #include "content/browser/renderer_host/media/audio_mirroring_manager.h" 15 #include "content/browser/renderer_host/media/audio_mirroring_manager.h"
17 #include "content/browser/renderer_host/media/audio_renderer_host.h" 16 #include "content/browser/renderer_host/media/audio_renderer_host.h"
18 #include "content/browser/renderer_host/media/media_stream_manager.h" 17 #include "content/browser/renderer_host/media/media_stream_manager.h"
19 #include "content/browser/renderer_host/media/mock_media_observer.h" 18 #include "content/browser/renderer_host/media/mock_media_observer.h"
20 #include "content/common/media/media_param_traits.h" 19 #include "content/common/media/media_param_traits.h"
21 #include "content/common/view_messages.h" 20 #include "content/common/view_messages.h"
(...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after
386 IPC_MESSAGE_UNHANDLED(handled = false) 385 IPC_MESSAGE_UNHANDLED(handled = false)
387 IPC_END_MESSAGE_MAP_EX() 386 IPC_END_MESSAGE_MAP_EX()
388 387
389 EXPECT_TRUE(message_is_ok); 388 EXPECT_TRUE(message_is_ok);
390 389
391 return true; 390 return true;
392 } 391 }
393 392
394 // Posts a final task to the IO message loop and waits for completion. 393 // Posts a final task to the IO message loop and waits for completion.
395 void MAYBE_WebRTCAudioDeviceTest::WaitForIOThreadCompletion() { 394 void MAYBE_WebRTCAudioDeviceTest::WaitForIOThreadCompletion() {
396 WaitForMessageLoopCompletion( 395 WaitForTaskRunnerCompletion(
397 ChildProcess::current()->io_message_loop()->message_loop_proxy().get()); 396 ChildProcess::current()->io_message_loop()->message_loop_proxy());
398 } 397 }
399 398
400 void MAYBE_WebRTCAudioDeviceTest::WaitForAudioManagerCompletion() { 399 void MAYBE_WebRTCAudioDeviceTest::WaitForAudioManagerCompletion() {
401 if (audio_manager_) 400 if (audio_manager_)
402 WaitForMessageLoopCompletion(audio_manager_->GetMessageLoop().get()); 401 WaitForTaskRunnerCompletion(audio_manager_->GetTaskRunner());
403 } 402 }
404 403
405 void MAYBE_WebRTCAudioDeviceTest::WaitForMessageLoopCompletion( 404 void MAYBE_WebRTCAudioDeviceTest::WaitForTaskRunnerCompletion(
406 base::MessageLoopProxy* loop) { 405 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner) {
407 base::WaitableEvent* event = new base::WaitableEvent(false, false); 406 base::WaitableEvent* event = new base::WaitableEvent(false, false);
408 loop->PostTask(FROM_HERE, base::Bind(&base::WaitableEvent::Signal, 407 task_runner->PostTask(
409 base::Unretained(event))); 408 FROM_HERE,
409 base::Bind(&base::WaitableEvent::Signal, base::Unretained(event)));
410 if (event->TimedWait(TestTimeouts::action_max_timeout())) { 410 if (event->TimedWait(TestTimeouts::action_max_timeout())) {
411 delete event; 411 delete event;
412 } else { 412 } else {
413 // Don't delete the event object in case the message ever gets processed. 413 // Don't delete the event object in case the message ever gets processed.
414 // If we do, we will crash the test process. 414 // If we do, we will crash the test process.
415 ADD_FAILURE() << "Failed to wait for message loop"; 415 ADD_FAILURE() << "Failed to wait for message loop";
416 } 416 }
417 } 417 }
418 418
419 std::string MAYBE_WebRTCAudioDeviceTest::GetTestDataPath( 419 std::string MAYBE_WebRTCAudioDeviceTest::GetTestDataPath(
(...skipping 18 matching lines...) Expand all
438 int WebRTCTransportImpl::SendPacket(int channel, const void* data, int len) { 438 int WebRTCTransportImpl::SendPacket(int channel, const void* data, int len) {
439 return network_->ReceivedRTPPacket(channel, data, len); 439 return network_->ReceivedRTPPacket(channel, data, len);
440 } 440 }
441 441
442 int WebRTCTransportImpl::SendRTCPPacket(int channel, const void* data, 442 int WebRTCTransportImpl::SendRTCPPacket(int channel, const void* data,
443 int len) { 443 int len) {
444 return network_->ReceivedRTCPPacket(channel, data, len); 444 return network_->ReceivedRTCPPacket(channel, data, len);
445 } 445 }
446 446
447 } // namespace content 447 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698