| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 <stddef.h> | 5 #include <stddef.h> |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 namespace media { | 22 namespace media { |
| 23 | 23 |
| 24 namespace { | 24 namespace { |
| 25 const float kTestVolume = 0.25; | 25 const float kTestVolume = 0.25; |
| 26 const int kSampleRate = 48000; | 26 const int kSampleRate = 48000; |
| 27 | 27 |
| 28 class WebAudioSourceProviderImplUnderTest : public WebAudioSourceProviderImpl { | 28 class WebAudioSourceProviderImplUnderTest : public WebAudioSourceProviderImpl { |
| 29 public: | 29 public: |
| 30 WebAudioSourceProviderImplUnderTest( | 30 WebAudioSourceProviderImplUnderTest( |
| 31 scoped_refptr<SwitchableAudioRendererSink> sink) | 31 scoped_refptr<SwitchableAudioRendererSink> sink) |
| 32 : WebAudioSourceProviderImpl(std::move(sink), new MediaLog()), | 32 : WebAudioSourceProviderImpl(std::move(sink), &media_log_), |
| 33 fallback_sink_(new MockAudioRendererSink()) {} | 33 fallback_sink_(new MockAudioRendererSink()) {} |
| 34 | 34 |
| 35 MockAudioRendererSink* fallback_sink() { return fallback_sink_.get(); } | 35 MockAudioRendererSink* fallback_sink() { return fallback_sink_.get(); } |
| 36 | 36 |
| 37 protected: | 37 protected: |
| 38 scoped_refptr<SwitchableAudioRendererSink> CreateFallbackSink() override { | 38 scoped_refptr<SwitchableAudioRendererSink> CreateFallbackSink() override { |
| 39 return fallback_sink_; | 39 return fallback_sink_; |
| 40 } | 40 } |
| 41 | 41 |
| 42 private: | 42 private: |
| 43 ~WebAudioSourceProviderImplUnderTest() override = default; | 43 ~WebAudioSourceProviderImplUnderTest() override = default; |
| 44 MediaLog media_log_; |
| 44 scoped_refptr<MockAudioRendererSink> fallback_sink_; | 45 scoped_refptr<MockAudioRendererSink> fallback_sink_; |
| 45 | 46 |
| 46 DISALLOW_COPY_AND_ASSIGN(WebAudioSourceProviderImplUnderTest); | 47 DISALLOW_COPY_AND_ASSIGN(WebAudioSourceProviderImplUnderTest); |
| 47 }; | 48 }; |
| 48 | 49 |
| 49 enum class WaspSinkStatus { WASP_SINK_OK, WASP_SINK_ERROR, WASP_SINK_NULL }; | 50 enum class WaspSinkStatus { WASP_SINK_OK, WASP_SINK_ERROR, WASP_SINK_NULL }; |
| 50 | 51 |
| 51 scoped_refptr<MockAudioRendererSink> CreateWaspMockSink(WaspSinkStatus status) { | 52 scoped_refptr<MockAudioRendererSink> CreateWaspMockSink(WaspSinkStatus status) { |
| 52 if (status == WaspSinkStatus::WASP_SINK_NULL) | 53 if (status == WaspSinkStatus::WASP_SINK_NULL) |
| 53 return nullptr; | 54 return nullptr; |
| (...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 342 } | 343 } |
| 343 | 344 |
| 344 INSTANTIATE_TEST_CASE_P( | 345 INSTANTIATE_TEST_CASE_P( |
| 345 /* prefix intentionally left blank due to only one parameterization */, | 346 /* prefix intentionally left blank due to only one parameterization */, |
| 346 WebAudioSourceProviderImplTest, | 347 WebAudioSourceProviderImplTest, |
| 347 testing::Values(WaspSinkStatus::WASP_SINK_OK, | 348 testing::Values(WaspSinkStatus::WASP_SINK_OK, |
| 348 WaspSinkStatus::WASP_SINK_ERROR, | 349 WaspSinkStatus::WASP_SINK_ERROR, |
| 349 WaspSinkStatus::WASP_SINK_NULL)); | 350 WaspSinkStatus::WASP_SINK_NULL)); |
| 350 | 351 |
| 351 } // namespace media | 352 } // namespace media |
| OLD | NEW |