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

Side by Side Diff: content/browser/renderer_host/media/audio_renderer_host_unittest.cc

Issue 1083883003: Move BindToCurrentLoop from media/base/ to base/ Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix media/base/callback_holder.h compile Created 5 years, 8 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
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/bind_to_current_loop.h"
6 #include "base/command_line.h" 7 #include "base/command_line.h"
7 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
8 #include "base/run_loop.h" 9 #include "base/run_loop.h"
9 #include "base/sync_socket.h" 10 #include "base/sync_socket.h"
10 #include "content/browser/media/capture/audio_mirroring_manager.h" 11 #include "content/browser/media/capture/audio_mirroring_manager.h"
11 #include "content/browser/media/media_internals.h" 12 #include "content/browser/media/media_internals.h"
12 #include "content/browser/renderer_host/media/audio_input_device_manager.h" 13 #include "content/browser/renderer_host/media/audio_input_device_manager.h"
13 #include "content/browser/renderer_host/media/audio_renderer_host.h" 14 #include "content/browser/renderer_host/media/audio_renderer_host.h"
14 #include "content/browser/renderer_host/media/media_stream_manager.h" 15 #include "content/browser/renderer_host/media/media_stream_manager.h"
15 #include "content/common/media/audio_messages.h" 16 #include "content/common/media/audio_messages.h"
16 #include "content/public/common/content_switches.h" 17 #include "content/public/common/content_switches.h"
17 #include "content/public/test/test_browser_thread_bundle.h" 18 #include "content/public/test/test_browser_thread_bundle.h"
18 #include "ipc/ipc_message_utils.h" 19 #include "ipc/ipc_message_utils.h"
19 #include "media/audio/audio_manager.h" 20 #include "media/audio/audio_manager.h"
20 #include "media/base/bind_to_current_loop.h"
21 #include "media/base/media_switches.h" 21 #include "media/base/media_switches.h"
22 #include "testing/gmock/include/gmock/gmock.h" 22 #include "testing/gmock/include/gmock/gmock.h"
23 #include "testing/gtest/include/gtest/gtest.h" 23 #include "testing/gtest/include/gtest/gtest.h"
24 24
25 using ::testing::_; 25 using ::testing::_;
26 using ::testing::Assign; 26 using ::testing::Assign;
27 using ::testing::DoAll; 27 using ::testing::DoAll;
28 using ::testing::NotNull; 28 using ::testing::NotNull;
29 29
30 namespace { 30 namespace {
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
247 247
248 // SyncWithAudioThread() waits until all pending tasks on the audio thread 248 // SyncWithAudioThread() waits until all pending tasks on the audio thread
249 // are executed while also processing pending task in message_loop_ on the 249 // are executed while also processing pending task in message_loop_ on the
250 // current thread. It is used to synchronize with the audio thread when we are 250 // current thread. It is used to synchronize with the audio thread when we are
251 // closing an audio stream. 251 // closing an audio stream.
252 void SyncWithAudioThread() { 252 void SyncWithAudioThread() {
253 base::RunLoop().RunUntilIdle(); 253 base::RunLoop().RunUntilIdle();
254 254
255 base::RunLoop run_loop; 255 base::RunLoop run_loop;
256 audio_manager_->GetTaskRunner()->PostTask( 256 audio_manager_->GetTaskRunner()->PostTask(
257 FROM_HERE, media::BindToCurrentLoop(run_loop.QuitClosure())); 257 FROM_HERE, base::BindToCurrentLoop(run_loop.QuitClosure()));
258 run_loop.Run(); 258 run_loop.Run();
259 } 259 }
260 260
261 private: 261 private:
262 // MediaStreamManager uses a DestructionObserver, so it must outlive the 262 // MediaStreamManager uses a DestructionObserver, so it must outlive the
263 // TestBrowserThreadBundle. 263 // TestBrowserThreadBundle.
264 scoped_ptr<MediaStreamManager> media_stream_manager_; 264 scoped_ptr<MediaStreamManager> media_stream_manager_;
265 TestBrowserThreadBundle thread_bundle_; 265 TestBrowserThreadBundle thread_bundle_;
266 scoped_ptr<media::AudioManager> audio_manager_; 266 scoped_ptr<media::AudioManager> audio_manager_;
267 MockAudioMirroringManager mirroring_manager_; 267 MockAudioMirroringManager mirroring_manager_;
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
331 } 331 }
332 332
333 TEST_F(AudioRendererHostTest, CreateUnifiedStreamAndClose) { 333 TEST_F(AudioRendererHostTest, CreateUnifiedStreamAndClose) {
334 Create(true); 334 Create(true);
335 Close(); 335 Close();
336 } 336 }
337 337
338 // TODO(hclam): Add tests for data conversation in low latency mode. 338 // TODO(hclam): Add tests for data conversation in low latency mode.
339 339
340 } // namespace content 340 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698