| 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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 mixer_input_->Stop(); | 90 mixer_input_->Stop(); |
| 91 } | 91 } |
| 92 | 92 |
| 93 // Test Start()/Play()/Pause()/Stop()/playing() all work as expected. Also | 93 // Test Start()/Play()/Pause()/Stop()/playing() all work as expected. Also |
| 94 // implicitly tests that AddMixerInput() and RemoveMixerInput() work without | 94 // implicitly tests that AddMixerInput() and RemoveMixerInput() work without |
| 95 // crashing; functional tests for these methods are in AudioRendererMixerTest. | 95 // crashing; functional tests for these methods are in AudioRendererMixerTest. |
| 96 TEST_F(AudioRendererMixerInputTest, StartPlayPauseStopPlaying) { | 96 TEST_F(AudioRendererMixerInputTest, StartPlayPauseStopPlaying) { |
| 97 mixer_input_->Start(); | 97 mixer_input_->Start(); |
| 98 mixer_input_->Play(); | 98 mixer_input_->Play(); |
| 99 EXPECT_DOUBLE_EQ(ProvideInput(), 1); | 99 EXPECT_DOUBLE_EQ(ProvideInput(), 1); |
| 100 mixer_input_->Pause(false); | 100 mixer_input_->Pause(); |
| 101 mixer_input_->Play(); | 101 mixer_input_->Play(); |
| 102 EXPECT_DOUBLE_EQ(ProvideInput(), 1); | 102 EXPECT_DOUBLE_EQ(ProvideInput(), 1); |
| 103 mixer_input_->Stop(); | 103 mixer_input_->Stop(); |
| 104 } | 104 } |
| 105 | 105 |
| 106 // Test that Stop() can be called before Initialize() and Start(). | 106 // Test that Stop() can be called before Initialize() and Start(). |
| 107 TEST_F(AudioRendererMixerInputTest, StopBeforeInitializeOrStart) { | 107 TEST_F(AudioRendererMixerInputTest, StopBeforeInitializeOrStart) { |
| 108 // |mixer_input_| was initialized during construction. | 108 // |mixer_input_| was initialized during construction. |
| 109 mixer_input_->Stop(); | 109 mixer_input_->Stop(); |
| 110 | 110 |
| 111 // Verify Stop() works without Initialize() or Start(). | 111 // Verify Stop() works without Initialize() or Start(). |
| 112 CreateMixerInput(); | 112 CreateMixerInput(); |
| 113 mixer_input_->Stop(); | 113 mixer_input_->Stop(); |
| 114 } | 114 } |
| 115 | 115 |
| 116 } // namespace media | 116 } // namespace media |
| OLD | NEW |