| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 <array> | 5 #include <array> |
| 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/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/test/test_simple_task_runner.h" | 10 #include "base/test/test_simple_task_runner.h" |
| 11 #include "base/test/test_timeouts.h" |
| 11 #include "content/renderer/media/audio_renderer_sink_cache_impl.h" | 12 #include "content/renderer/media/audio_renderer_sink_cache_impl.h" |
| 12 #include "media/audio/audio_device_description.h" | 13 #include "media/audio/audio_device_description.h" |
| 13 #include "media/base/audio_parameters.h" | 14 #include "media/base/audio_parameters.h" |
| 14 #include "media/base/mock_audio_renderer_sink.h" | 15 #include "media/base/mock_audio_renderer_sink.h" |
| 15 #include "media/base/test_helpers.h" | 16 #include "media/base/test_helpers.h" |
| 16 #include "testing/gmock/include/gmock/gmock.h" | 17 #include "testing/gmock/include/gmock/gmock.h" |
| 17 #include "testing/gtest/include/gtest/gtest.h" | 18 #include "testing/gtest/include/gtest/gtest.h" |
| 18 #include "url/gurl.h" | 19 #include "url/gurl.h" |
| 19 | 20 |
| 20 namespace content { | 21 namespace content { |
| (...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 355 FROM_HERE, base::Bind(&AudioRendererSinkCacheTest::GetRandomSinkInfo, | 356 FROM_HERE, base::Bind(&AudioRendererSinkCacheTest::GetRandomSinkInfo, |
| 356 base::Unretained(this), rand() % kSinkCount)); | 357 base::Unretained(this), rand() % kSinkCount)); |
| 357 thread->task_runner()->PostTask( | 358 thread->task_runner()->PostTask( |
| 358 FROM_HERE, base::Bind(&AudioRendererSinkCacheTest::GetRandomSink, | 359 FROM_HERE, base::Bind(&AudioRendererSinkCacheTest::GetRandomSink, |
| 359 base::Unretained(this), rand() % kSinkCount, | 360 base::Unretained(this), rand() % kSinkCount, |
| 360 kSleepTimeout)); | 361 kSleepTimeout)); |
| 361 } | 362 } |
| 362 } | 363 } |
| 363 | 364 |
| 364 // Wait for completion of all the tasks posted to at least one thread. | 365 // Wait for completion of all the tasks posted to at least one thread. |
| 365 media::WaitableMessageLoopEvent loop_event; | 366 media::WaitableMessageLoopEvent loop_event( |
| 367 TestTimeouts::action_max_timeout()); |
| 366 threads[kThreadCount - 1]->task_runner()->PostTaskAndReply( | 368 threads[kThreadCount - 1]->task_runner()->PostTaskAndReply( |
| 367 FROM_HERE, base::Bind(&base::DoNothing), loop_event.GetClosure()); | 369 FROM_HERE, base::Bind(&base::DoNothing), loop_event.GetClosure()); |
| 368 // Runs the loop and waits for the thread to call event's closure. | 370 // Runs the loop and waits for the thread to call event's closure. |
| 369 loop_event.RunAndWait(); | 371 loop_event.RunAndWait(); |
| 370 } | 372 } |
| 371 | 373 |
| 372 } // namespace content | 374 } // namespace content |
| OLD | NEW |