| 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 "content/renderer/media/audio_renderer_sink_cache_impl.h" | 11 #include "content/renderer/media/audio_renderer_sink_cache_impl.h" |
| 12 #include "media/audio/audio_device_description.h" | 12 #include "media/audio/audio_device_description.h" |
| 13 #include "media/base/audio_parameters.h" | 13 #include "media/base/audio_parameters.h" |
| 14 #include "media/base/mock_audio_renderer_sink.h" | 14 #include "media/base/mock_audio_renderer_sink.h" |
| 15 #include "media/base/test_helpers.h" | 15 #include "media/base/test_helpers.h" |
| 16 #include "testing/gmock/include/gmock/gmock.h" | 16 #include "testing/gmock/include/gmock/gmock.h" |
| 17 #include "testing/gtest/include/gtest/gtest.h" | 17 #include "testing/gtest/include/gtest/gtest.h" |
| 18 #include "url/gurl.h" | 18 #include "url/gurl.h" |
| 19 | 19 |
| 20 namespace content { | 20 namespace content { |
| 21 | 21 |
| 22 namespace { | 22 namespace { |
| 23 const char* const kDefaultDeviceId = | 23 const char* const kDefaultDeviceId = |
| 24 media::AudioDeviceDescription::kDefaultDeviceId; | 24 media::AudioDeviceDescription::kDefaultDeviceId; |
| 25 const char kAnotherDeviceId[] = "another-device-id"; | 25 const char kAnotherDeviceId[] = "another-device-id"; |
| 26 const int kRenderFrameId = 124; | 26 const int kRenderFrameId = 124; |
| 27 const int kDeleteTimeoutMs = 1000; | 27 const int kDeleteTimeoutMs = 500; |
| 28 } // namespace | 28 } // namespace |
| 29 | 29 |
| 30 class AudioRendererSinkCacheTest : public testing::Test { | 30 class AudioRendererSinkCacheTest : public testing::Test { |
| 31 public: | 31 public: |
| 32 AudioRendererSinkCacheTest() | 32 AudioRendererSinkCacheTest() |
| 33 : cache_(new AudioRendererSinkCacheImpl( | 33 : cache_(new AudioRendererSinkCacheImpl( |
| 34 message_loop_.task_runner(), | 34 message_loop_.task_runner(), |
| 35 base::Bind(&AudioRendererSinkCacheTest::CreateSink, | 35 base::Bind(&AudioRendererSinkCacheTest::CreateSink, |
| 36 base::Unretained(this)), | 36 base::Unretained(this)), |
| 37 base::TimeDelta::FromMilliseconds(kDeleteTimeoutMs))) {} | 37 base::TimeDelta::FromMilliseconds(kDeleteTimeoutMs))) {} |
| (...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 363 | 363 |
| 364 // Wait for completion of all the tasks posted to at least one thread. | 364 // Wait for completion of all the tasks posted to at least one thread. |
| 365 media::WaitableMessageLoopEvent loop_event; | 365 media::WaitableMessageLoopEvent loop_event; |
| 366 threads[kThreadCount - 1]->task_runner()->PostTaskAndReply( | 366 threads[kThreadCount - 1]->task_runner()->PostTaskAndReply( |
| 367 FROM_HERE, base::Bind(&base::DoNothing), loop_event.GetClosure()); | 367 FROM_HERE, base::Bind(&base::DoNothing), loop_event.GetClosure()); |
| 368 // Runs the loop and waits for the thread to call event's closure. | 368 // Runs the loop and waits for the thread to call event's closure. |
| 369 loop_event.RunAndWait(); | 369 loop_event.RunAndWait(); |
| 370 } | 370 } |
| 371 | 371 |
| 372 } // namespace content | 372 } // namespace content |
| OLD | NEW |