| 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/bind.h" | 5 #include "base/bind.h" |
| 6 #include "base/bind_helpers.h" | 6 #include "base/bind_helpers.h" |
| 7 #include "media/base/audio_renderer_mixer.h" | 7 #include "media/base/audio_renderer_mixer.h" |
| 8 #include "media/base/audio_renderer_mixer_input.h" | 8 #include "media/base/audio_renderer_mixer_input.h" |
| 9 #include "media/base/fake_audio_render_callback.h" | 9 #include "media/base/fake_audio_render_callback.h" |
| 10 #include "media/base/mock_audio_renderer_sink.h" | 10 #include "media/base/mock_audio_renderer_sink.h" |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 mixer_input_ = new AudioRendererMixerInput( | 36 mixer_input_ = new AudioRendererMixerInput( |
| 37 base::Bind( | 37 base::Bind( |
| 38 &AudioRendererMixerInputTest::GetMixer, base::Unretained(this)), | 38 &AudioRendererMixerInputTest::GetMixer, base::Unretained(this)), |
| 39 base::Bind( | 39 base::Bind( |
| 40 &AudioRendererMixerInputTest::RemoveMixer, base::Unretained(this))); | 40 &AudioRendererMixerInputTest::RemoveMixer, base::Unretained(this))); |
| 41 } | 41 } |
| 42 | 42 |
| 43 AudioRendererMixer* GetMixer(const AudioParameters& params) { | 43 AudioRendererMixer* GetMixer(const AudioParameters& params) { |
| 44 if (!mixer_) { | 44 if (!mixer_) { |
| 45 scoped_refptr<MockAudioRendererSink> sink = new MockAudioRendererSink(); | 45 scoped_refptr<MockAudioRendererSink> sink = new MockAudioRendererSink(); |
| 46 EXPECT_CALL(*sink, Start()); | 46 EXPECT_CALL(*sink.get(), Start()); |
| 47 EXPECT_CALL(*sink, Stop()); | 47 EXPECT_CALL(*sink.get(), Stop()); |
| 48 | 48 |
| 49 mixer_.reset(new AudioRendererMixer( | 49 mixer_.reset(new AudioRendererMixer( |
| 50 audio_parameters_, audio_parameters_, sink)); | 50 audio_parameters_, audio_parameters_, sink)); |
| 51 } | 51 } |
| 52 return mixer_.get(); | 52 return mixer_.get(); |
| 53 } | 53 } |
| 54 | 54 |
| 55 double ProvideInput() { | 55 double ProvideInput() { |
| 56 return mixer_input_->ProvideInput(audio_bus_.get(), base::TimeDelta()); | 56 return mixer_input_->ProvideInput(audio_bus_.get(), base::TimeDelta()); |
| 57 } | 57 } |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 TEST_F(AudioRendererMixerInputTest, StopBeforeInitializeOrStart) { | 103 TEST_F(AudioRendererMixerInputTest, StopBeforeInitializeOrStart) { |
| 104 // |mixer_input_| was initialized during construction. | 104 // |mixer_input_| was initialized during construction. |
| 105 mixer_input_->Stop(); | 105 mixer_input_->Stop(); |
| 106 | 106 |
| 107 // Verify Stop() works without Initialize() or Start(). | 107 // Verify Stop() works without Initialize() or Start(). |
| 108 CreateMixerInput(); | 108 CreateMixerInput(); |
| 109 mixer_input_->Stop(); | 109 mixer_input_->Stop(); |
| 110 } | 110 } |
| 111 | 111 |
| 112 } // namespace media | 112 } // namespace media |
| OLD | NEW |