| 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 // MSVC++ requires this to be set before any other includes to get M_PI. | 5 // MSVC++ requires this to be set before any other includes to get M_PI. |
| 6 #define _USE_MATH_DEFINES | 6 #define _USE_MATH_DEFINES |
| 7 #include <cmath> | 7 #include <cmath> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| 11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
| 12 #include "base/memory/scoped_vector.h" | 12 #include "base/memory/scoped_vector.h" |
| 13 #include "base/synchronization/waitable_event.h" | 13 #include "base/synchronization/waitable_event.h" |
| 14 #include "base/threading/platform_thread.h" | 14 #include "base/threading/platform_thread.h" |
| 15 #include "media/base/audio_renderer_mixer.h" | 15 #include "media/base/audio_renderer_mixer.h" |
| 16 #include "media/base/audio_renderer_mixer_input.h" | 16 #include "media/base/audio_renderer_mixer_input.h" |
| 17 #include "media/base/fake_audio_render_callback.h" | 17 #include "media/base/fake_audio_render_callback.h" |
| 18 #include "media/base/mock_audio_renderer_sink.h" | 18 #include "media/base/mock_audio_renderer_sink.h" |
| 19 #include "testing/gmock/include/gmock/gmock.h" | 19 #include "testing/gmock/include/gmock/gmock.h" |
| 20 #include "testing/gtest/include/gtest/gtest.h" | 20 #include "testing/gtest/include/gtest/gtest.h" |
| 21 | 21 |
| 22 namespace media { | 22 namespace media { |
| 23 | 23 |
| 24 // Parameters which control the many input case tests. | 24 // Parameters which control the many input case tests. |
| 25 static const int kMixerInputs = 8; | 25 const int kMixerInputs = 8; |
| 26 static const int kMixerCycles = 3; | 26 const int kMixerCycles = 3; |
| 27 | 27 |
| 28 // Parameters used for testing. | 28 // Parameters used for testing. |
| 29 static const int kBitsPerChannel = 32; | 29 const int kBitsPerChannel = 32; |
| 30 static const ChannelLayout kChannelLayout = CHANNEL_LAYOUT_STEREO; | 30 const ChannelLayout kChannelLayout = CHANNEL_LAYOUT_STEREO; |
| 31 static const int kHighLatencyBufferSize = 8192; | 31 const int kHighLatencyBufferSize = 8192; |
| 32 static const int kLowLatencyBufferSize = 256; | 32 const int kLowLatencyBufferSize = 256; |
| 33 static const int kSampleRate = 48000; | |
| 34 | 33 |
| 35 // Number of full sine wave cycles for each Render() call. | 34 // Number of full sine wave cycles for each Render() call. |
| 36 static const int kSineCycles = 4; | 35 const int kSineCycles = 4; |
| 37 | 36 |
| 38 // Tuple of <input sampling rate, output sampling rate, epsilon>. | 37 // Tuple of <input sampling rate, output sampling rate, epsilon>. |
| 39 typedef std::tr1::tuple<int, int, double> AudioRendererMixerTestData; | 38 typedef std::tr1::tuple<int, int, double> AudioRendererMixerTestData; |
| 40 class AudioRendererMixerTest | 39 class AudioRendererMixerTest |
| 41 : public testing::TestWithParam<AudioRendererMixerTestData> { | 40 : public testing::TestWithParam<AudioRendererMixerTestData> { |
| 42 public: | 41 public: |
| 43 AudioRendererMixerTest() | 42 AudioRendererMixerTest() |
| 44 : epsilon_(std::tr1::get<2>(GetParam())), | 43 : epsilon_(std::tr1::get<2>(GetParam())), |
| 45 half_fill_(false) { | 44 half_fill_(false) { |
| 46 // Create input and output parameters based on test parameters. | 45 // Create input and output parameters based on test parameters. |
| (...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 459 | 458 |
| 460 // Test cases for behavior which is independent of parameters. Values() doesn't | 459 // Test cases for behavior which is independent of parameters. Values() doesn't |
| 461 // support single item lists and we don't want these test cases to run for every | 460 // support single item lists and we don't want these test cases to run for every |
| 462 // parameter set. | 461 // parameter set. |
| 463 INSTANTIATE_TEST_CASE_P( | 462 INSTANTIATE_TEST_CASE_P( |
| 464 AudioRendererMixerBehavioralTest, AudioRendererMixerBehavioralTest, | 463 AudioRendererMixerBehavioralTest, AudioRendererMixerBehavioralTest, |
| 465 testing::ValuesIn(std::vector<AudioRendererMixerTestData>( | 464 testing::ValuesIn(std::vector<AudioRendererMixerTestData>( |
| 466 1, std::tr1::make_tuple(44100, 44100, 0)))); | 465 1, std::tr1::make_tuple(44100, 44100, 0)))); |
| 467 | 466 |
| 468 } // namespace media | 467 } // namespace media |
| OLD | NEW |