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 <stdint.h> | 5 #include <stdint.h> |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/at_exit.h" | 9 #include "base/at_exit.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
11 #include "base/callback.h" | 11 #include "base/callback.h" |
12 #include "base/macros.h" | 12 #include "base/macros.h" |
13 #include "base/memory/ptr_util.h" | 13 #include "base/memory/ptr_util.h" |
14 #include "base/memory/shared_memory.h" | 14 #include "base/memory/shared_memory.h" |
15 #include "base/message_loop/message_loop.h" | 15 #include "base/message_loop/message_loop.h" |
16 #include "base/process/process_handle.h" | 16 #include "base/process/process_handle.h" |
| 17 #include "base/single_thread_task_runner.h" |
17 #include "base/sync_socket.h" | 18 #include "base/sync_socket.h" |
18 #include "base/task_runner.h" | 19 #include "base/task_runner.h" |
19 #include "base/test/test_timeouts.h" | 20 #include "base/test/test_timeouts.h" |
20 #include "base/threading/thread.h" | 21 #include "base/threading/thread.h" |
21 #include "base/threading/thread_task_runner_handle.h" | 22 #include "base/threading/thread_task_runner_handle.h" |
22 #include "media/audio/audio_output_device.h" | 23 #include "media/audio/audio_output_device.h" |
23 #include "media/audio/sample_rates.h" | 24 #include "media/audio/sample_rates.h" |
24 #include "media/base/test_helpers.h" | 25 #include "media/base/test_helpers.h" |
25 #include "testing/gmock/include/gmock/gmock.h" | 26 #include "testing/gmock/include/gmock/gmock.h" |
26 #include "testing/gmock_mutant.h" | 27 #include "testing/gmock_mutant.h" |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
238 // So, for the sake of this test, we consider the call to Render a sign | 239 // So, for the sake of this test, we consider the call to Render a sign |
239 // of success and quit the loop. | 240 // of success and quit the loop. |
240 const int kNumberOfFramesToProcess = 0; | 241 const int kNumberOfFramesToProcess = 0; |
241 EXPECT_CALL(callback_, Render(_, _, _)) | 242 EXPECT_CALL(callback_, Render(_, _, _)) |
242 .WillOnce(DoAll(QuitLoop(io_loop_.task_runner()), | 243 .WillOnce(DoAll(QuitLoop(io_loop_.task_runner()), |
243 Return(kNumberOfFramesToProcess))); | 244 Return(kNumberOfFramesToProcess))); |
244 } | 245 } |
245 | 246 |
246 void AudioOutputDeviceTest::WaitUntilRenderCallback() { | 247 void AudioOutputDeviceTest::WaitUntilRenderCallback() { |
247 // Don't hang the test if we never get the Render() callback. | 248 // Don't hang the test if we never get the Render() callback. |
248 io_loop_.PostDelayedTask(FROM_HERE, base::MessageLoop::QuitWhenIdleClosure(), | 249 io_loop_.task_runner()->PostDelayedTask( |
249 TestTimeouts::action_timeout()); | 250 FROM_HERE, base::MessageLoop::QuitWhenIdleClosure(), |
| 251 TestTimeouts::action_timeout()); |
250 io_loop_.Run(); | 252 io_loop_.Run(); |
251 } | 253 } |
252 | 254 |
253 void AudioOutputDeviceTest::StopAudioDevice() { | 255 void AudioOutputDeviceTest::StopAudioDevice() { |
254 if (device_status_ == OUTPUT_DEVICE_STATUS_OK) | 256 if (device_status_ == OUTPUT_DEVICE_STATUS_OK) |
255 EXPECT_CALL(*audio_output_ipc_, CloseStream()); | 257 EXPECT_CALL(*audio_output_ipc_, CloseStream()); |
256 | 258 |
257 audio_device_->Stop(); | 259 audio_device_->Stop(); |
258 io_loop_.RunUntilIdle(); | 260 io_loop_.RunUntilIdle(); |
259 } | 261 } |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
360 // Runs the loop and waits for |thread| to call event's closure. | 362 // Runs the loop and waits for |thread| to call event's closure. |
361 event.RunAndWait(); | 363 event.RunAndWait(); |
362 | 364 |
363 audio_device_->Stop(); | 365 audio_device_->Stop(); |
364 io_loop_.RunUntilIdle(); | 366 io_loop_.RunUntilIdle(); |
365 } | 367 } |
366 | 368 |
367 INSTANTIATE_TEST_CASE_P(Render, AudioOutputDeviceTest, Values(false)); | 369 INSTANTIATE_TEST_CASE_P(Render, AudioOutputDeviceTest, Values(false)); |
368 | 370 |
369 } // namespace media. | 371 } // namespace media. |
OLD | NEW |