| 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 <stddef.h> | 5 #include <stddef.h> |
| 6 #include <memory> |
| 6 | 7 |
| 7 #include "base/bind.h" | 8 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 9 #include "base/bind_helpers.h" |
| 9 #include "base/macros.h" | 10 #include "base/macros.h" |
| 10 #include "base/run_loop.h" | 11 #include "base/run_loop.h" |
| 11 #include "media/base/audio_renderer_mixer.h" | 12 #include "media/base/audio_renderer_mixer.h" |
| 12 #include "media/base/audio_renderer_mixer_input.h" | 13 #include "media/base/audio_renderer_mixer_input.h" |
| 13 #include "media/base/fake_audio_render_callback.h" | 14 #include "media/base/fake_audio_render_callback.h" |
| 14 #include "media/base/mock_audio_renderer_sink.h" | 15 #include "media/base/mock_audio_renderer_sink.h" |
| 15 #include "testing/gmock/include/gmock/gmock.h" | 16 #include "testing/gmock/include/gmock/gmock.h" |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 SwitchCallbackCalled(result); | 93 SwitchCallbackCalled(result); |
| 93 loop->Quit(); | 94 loop->Quit(); |
| 94 } | 95 } |
| 95 | 96 |
| 96 AudioRendererMixer* GetInputMixer() { return mixer_input_->mixer_; } | 97 AudioRendererMixer* GetInputMixer() { return mixer_input_->mixer_; } |
| 97 | 98 |
| 98 protected: | 99 protected: |
| 99 virtual ~AudioRendererMixerInputTest() {} | 100 virtual ~AudioRendererMixerInputTest() {} |
| 100 | 101 |
| 101 AudioParameters audio_parameters_; | 102 AudioParameters audio_parameters_; |
| 102 scoped_ptr<AudioRendererMixer> mixers_[2]; | 103 std::unique_ptr<AudioRendererMixer> mixers_[2]; |
| 103 scoped_refptr<AudioRendererMixerInput> mixer_input_; | 104 scoped_refptr<AudioRendererMixerInput> mixer_input_; |
| 104 scoped_ptr<FakeAudioRenderCallback> fake_callback_; | 105 std::unique_ptr<FakeAudioRenderCallback> fake_callback_; |
| 105 scoped_ptr<AudioBus> audio_bus_; | 106 std::unique_ptr<AudioBus> audio_bus_; |
| 106 | 107 |
| 107 private: | 108 private: |
| 108 DISALLOW_COPY_AND_ASSIGN(AudioRendererMixerInputTest); | 109 DISALLOW_COPY_AND_ASSIGN(AudioRendererMixerInputTest); |
| 109 }; | 110 }; |
| 110 | 111 |
| 111 // Test that getting and setting the volume work as expected. The volume is | 112 // Test that getting and setting the volume work as expected. The volume is |
| 112 // returned from ProvideInput() only when playing. | 113 // returned from ProvideInput() only when playing. |
| 113 TEST_F(AudioRendererMixerInputTest, GetSetVolume) { | 114 TEST_F(AudioRendererMixerInputTest, GetSetVolume) { |
| 114 mixer_input_->Start(); | 115 mixer_input_->Start(); |
| 115 mixer_input_->Play(); | 116 mixer_input_->Play(); |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 270 EXPECT_CALL(*this, SwitchCallbackCalled(OUTPUT_DEVICE_STATUS_ERROR_INTERNAL)); | 271 EXPECT_CALL(*this, SwitchCallbackCalled(OUTPUT_DEVICE_STATUS_ERROR_INTERNAL)); |
| 271 mixer_input_->SwitchOutputDevice( | 272 mixer_input_->SwitchOutputDevice( |
| 272 kDefaultDeviceId, url::Origin(), | 273 kDefaultDeviceId, url::Origin(), |
| 273 base::Bind(&AudioRendererMixerInputTest::SwitchCallback, | 274 base::Bind(&AudioRendererMixerInputTest::SwitchCallback, |
| 274 base::Unretained(this), &run_loop)); | 275 base::Unretained(this), &run_loop)); |
| 275 mixer_input_->Stop(); | 276 mixer_input_->Stop(); |
| 276 run_loop.Run(); | 277 run_loop.Run(); |
| 277 } | 278 } |
| 278 | 279 |
| 279 } // namespace media | 280 } // namespace media |
| OLD | NEW |