| 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 "base/memory/scoped_ptr.h" | 5 #include "base/memory/scoped_ptr.h" |
| 6 #include "content/renderer/media/audio_device_factory.h" | 6 #include "content/renderer/media/audio_device_factory.h" |
| 7 #include "content/renderer/media/audio_renderer_mixer_manager.h" | 7 #include "content/renderer/media/audio_renderer_mixer_manager.h" |
| 8 #include "media/base/audio_renderer_mixer.h" | 8 #include "media/base/audio_renderer_mixer.h" |
| 9 #include "media/base/audio_renderer_mixer_input.h" | 9 #include "media/base/audio_renderer_mixer_input.h" |
| 10 #include "media/base/fake_audio_render_callback.h" | 10 #include "media/base/fake_audio_render_callback.h" |
| 11 #include "media/base/mock_audio_renderer_sink.h" | 11 #include "media/base/mock_audio_renderer_sink.h" |
| 12 #include "testing/gmock/include/gmock/gmock.h" | 12 #include "testing/gmock/include/gmock/gmock.h" |
| 13 #include "testing/gtest/include/gtest/gtest.h" | 13 #include "testing/gtest/include/gtest/gtest.h" |
| 14 | 14 |
| 15 namespace content { | 15 namespace content { |
| 16 | 16 |
| 17 static const int kBitsPerChannel = 16; | 17 static const int kBitsPerChannel = 16; |
| 18 static const int kSampleRate = 48000; | 18 static const int kSampleRate = 48000; |
| 19 static const int kBufferSize = 8192; | 19 static const int kBufferSize = 8192; |
| 20 static const ChannelLayout kChannelLayout = CHANNEL_LAYOUT_STEREO; | 20 static const media::ChannelLayout kChannelLayout = media::CHANNEL_LAYOUT_STEREO; |
| 21 | 21 |
| 22 // By sub-classing AudioDeviceFactory we've overridden the factory to use our | 22 // By sub-classing AudioDeviceFactory we've overridden the factory to use our |
| 23 // CreateAudioDevice() method globally. | 23 // CreateAudioDevice() method globally. |
| 24 class MockAudioRenderSinkFactory : public AudioDeviceFactory { | 24 class MockAudioRenderSinkFactory : public AudioDeviceFactory { |
| 25 public: | 25 public: |
| 26 MockAudioRenderSinkFactory() {} | 26 MockAudioRenderSinkFactory() {} |
| 27 virtual ~MockAudioRenderSinkFactory() {} | 27 virtual ~MockAudioRenderSinkFactory() {} |
| 28 | 28 |
| 29 protected: | 29 protected: |
| 30 virtual media::MockAudioRendererSink* CreateOutputDevice() OVERRIDE { | 30 virtual media::MockAudioRendererSink* CreateOutputDevice() OVERRIDE { |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 media::FakeAudioRenderCallback callback(0); | 127 media::FakeAudioRenderCallback callback(0); |
| 128 input->Initialize(params, &callback); | 128 input->Initialize(params, &callback); |
| 129 EXPECT_EQ(mixer_count(), 1); | 129 EXPECT_EQ(mixer_count(), 1); |
| 130 | 130 |
| 131 // Destroying the input should destroy the mixer. | 131 // Destroying the input should destroy the mixer. |
| 132 input = NULL; | 132 input = NULL; |
| 133 EXPECT_EQ(mixer_count(), 0); | 133 EXPECT_EQ(mixer_count(), 0); |
| 134 } | 134 } |
| 135 | 135 |
| 136 } // namespace content | 136 } // namespace content |
| OLD | NEW |