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

Side by Side Diff: content/browser/renderer_host/media/audio_renderer_host_unittest.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 "base/bind.h" 5 #include "base/bind.h"
6 #include "base/environment.h" 6 #include "base/environment.h"
7 #include "base/memory/scoped_ptr.h" 7 #include "base/memory/scoped_ptr.h"
8 #include "base/message_loop/message_loop.h"
9 #include "base/sync_socket.h" 8 #include "base/sync_socket.h"
10 #include "content/browser/browser_thread_impl.h" 9 #include "content/browser/browser_thread_impl.h"
11 #include "content/browser/renderer_host/media/audio_input_device_manager.h" 10 #include "content/browser/renderer_host/media/audio_input_device_manager.h"
12 #include "content/browser/renderer_host/media/audio_mirroring_manager.h" 11 #include "content/browser/renderer_host/media/audio_mirroring_manager.h"
13 #include "content/browser/renderer_host/media/audio_renderer_host.h" 12 #include "content/browser/renderer_host/media/audio_renderer_host.h"
14 #include "content/browser/renderer_host/media/media_stream_manager.h" 13 #include "content/browser/renderer_host/media/media_stream_manager.h"
15 #include "content/browser/renderer_host/media/mock_media_observer.h" 14 #include "content/browser/renderer_host/media/mock_media_observer.h"
16 #include "content/common/media/audio_messages.h" 15 #include "content/common/media/audio_messages.h"
17 #include "content/common/media/media_stream_options.h" 16 #include "content/common/media/media_stream_options.h"
18 #include "ipc/ipc_message_utils.h" 17 #include "ipc/ipc_message_utils.h"
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after
311 } 310 }
312 311
313 // Called on the audio thread. 312 // Called on the audio thread.
314 static void PostQuitMessageLoop(base::MessageLoop* message_loop) { 313 static void PostQuitMessageLoop(base::MessageLoop* message_loop) {
315 message_loop->PostTask(FROM_HERE, base::MessageLoop::QuitClosure()); 314 message_loop->PostTask(FROM_HERE, base::MessageLoop::QuitClosure());
316 } 315 }
317 316
318 // Called on the main thread. 317 // Called on the main thread.
319 static void PostQuitOnAudioThread(media::AudioManager* audio_manager, 318 static void PostQuitOnAudioThread(media::AudioManager* audio_manager,
320 base::MessageLoop* message_loop) { 319 base::MessageLoop* message_loop) {
321 audio_manager->GetMessageLoop()->PostTask(FROM_HERE, 320 audio_manager->GetTaskRunner()->PostTask(FROM_HERE,
322 base::Bind(&PostQuitMessageLoop, message_loop)); 321 base::Bind(&PostQuitMessageLoop, message_loop));
323 } 322 }
324 323
325 // SyncWithAudioThread() waits until all pending tasks on the audio thread 324 // SyncWithAudioThread() waits until all pending tasks on the audio thread
326 // are executed while also processing pending task in message_loop_ on the 325 // are executed while also processing pending task in message_loop_ on the
327 // current thread. It is used to synchronize with the audio thread when we are 326 // current thread. It is used to synchronize with the audio thread when we are
328 // closing an audio stream. 327 // closing an audio stream.
329 void SyncWithAudioThread() { 328 void SyncWithAudioThread() {
330 // Don't use scoped_refptr to addref the media::AudioManager when posting 329 // Don't use scoped_refptr to addref the media::AudioManager when posting
331 // to the thread that itself owns. 330 // to the thread that itself owns.
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
412 } 411 }
413 412
414 TEST_F(AudioRendererHostTest, CreateUnifiedStreamAndClose) { 413 TEST_F(AudioRendererHostTest, CreateUnifiedStreamAndClose) {
415 Create(true); 414 Create(true);
416 Close(); 415 Close();
417 } 416 }
418 417
419 // TODO(hclam): Add tests for data conversation in low latency mode. 418 // TODO(hclam): Add tests for data conversation in low latency mode.
420 419
421 } // namespace content 420 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698