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 #include <memory> |
7 | 7 |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/bind_helpers.h" | 9 #include "base/bind_helpers.h" |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
11 #include "base/run_loop.h" | 11 #include "base/run_loop.h" |
| 12 #include "base/test/scoped_task_environment.h" |
12 #include "media/base/audio_latency.h" | 13 #include "media/base/audio_latency.h" |
13 #include "media/base/audio_renderer_mixer.h" | 14 #include "media/base/audio_renderer_mixer.h" |
14 #include "media/base/audio_renderer_mixer_input.h" | 15 #include "media/base/audio_renderer_mixer_input.h" |
15 #include "media/base/audio_renderer_mixer_pool.h" | 16 #include "media/base/audio_renderer_mixer_pool.h" |
16 #include "media/base/fake_audio_render_callback.h" | 17 #include "media/base/fake_audio_render_callback.h" |
17 #include "media/base/mock_audio_renderer_sink.h" | 18 #include "media/base/mock_audio_renderer_sink.h" |
18 #include "testing/gmock/include/gmock/gmock.h" | 19 #include "testing/gmock/include/gmock/gmock.h" |
19 #include "testing/gtest/include/gtest/gtest.h" | 20 #include "testing/gtest/include/gtest/gtest.h" |
20 | 21 |
21 namespace { | 22 namespace { |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 void SwitchCallback(base::RunLoop* loop, OutputDeviceStatus result) { | 118 void SwitchCallback(base::RunLoop* loop, OutputDeviceStatus result) { |
118 SwitchCallbackCalled(result); | 119 SwitchCallbackCalled(result); |
119 loop->Quit(); | 120 loop->Quit(); |
120 } | 121 } |
121 | 122 |
122 AudioRendererMixer* GetInputMixer() { return mixer_input_->mixer_; } | 123 AudioRendererMixer* GetInputMixer() { return mixer_input_->mixer_; } |
123 | 124 |
124 protected: | 125 protected: |
125 virtual ~AudioRendererMixerInputTest() {} | 126 virtual ~AudioRendererMixerInputTest() {} |
126 | 127 |
127 base::MessageLoop message_loop_; | 128 base::test::ScopedTaskEnvironment scoped_task_environment_; |
128 AudioParameters audio_parameters_; | 129 AudioParameters audio_parameters_; |
129 scoped_refptr<MockAudioRendererSink> sinks_[2]; | 130 scoped_refptr<MockAudioRendererSink> sinks_[2]; |
130 std::unique_ptr<AudioRendererMixer> mixers_[2]; | 131 std::unique_ptr<AudioRendererMixer> mixers_[2]; |
131 scoped_refptr<AudioRendererMixerInput> mixer_input_; | 132 scoped_refptr<AudioRendererMixerInput> mixer_input_; |
132 std::unique_ptr<FakeAudioRenderCallback> fake_callback_; | 133 std::unique_ptr<FakeAudioRenderCallback> fake_callback_; |
133 std::unique_ptr<AudioBus> audio_bus_; | 134 std::unique_ptr<AudioBus> audio_bus_; |
134 | 135 |
135 private: | 136 private: |
136 DISALLOW_COPY_AND_ASSIGN(AudioRendererMixerInputTest); | 137 DISALLOW_COPY_AND_ASSIGN(AudioRendererMixerInputTest); |
137 }; | 138 }; |
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
397 base::Bind(&AudioRendererMixerInputTest::SwitchCallback, | 398 base::Bind(&AudioRendererMixerInputTest::SwitchCallback, |
398 base::Unretained(this), &run_loop)); | 399 base::Unretained(this), &run_loop)); |
399 run_loop.Run(); | 400 run_loop.Run(); |
400 | 401 |
401 mixer_input_->Initialize(audio_parameters_, fake_callback_.get()); | 402 mixer_input_->Initialize(audio_parameters_, fake_callback_.get()); |
402 mixer_input_->Start(); | 403 mixer_input_->Start(); |
403 mixer_input_->Stop(); | 404 mixer_input_->Stop(); |
404 } | 405 } |
405 | 406 |
406 } // namespace media | 407 } // namespace media |
OLD | NEW |