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 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/macros.h" | 9 #include "base/macros.h" |
10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
(...skipping 26 matching lines...) Expand all Loading... |
37 mixer_input_->Initialize(audio_parameters_, fake_callback_.get()); | 37 mixer_input_->Initialize(audio_parameters_, fake_callback_.get()); |
38 audio_bus_ = AudioBus::Create(audio_parameters_); | 38 audio_bus_ = AudioBus::Create(audio_parameters_); |
39 } | 39 } |
40 | 40 |
41 void CreateMixerInput(const std::string& device_id) { | 41 void CreateMixerInput(const std::string& device_id) { |
42 mixer_input_ = new AudioRendererMixerInput( | 42 mixer_input_ = new AudioRendererMixerInput( |
43 base::Bind(&AudioRendererMixerInputTest::GetMixer, | 43 base::Bind(&AudioRendererMixerInputTest::GetMixer, |
44 base::Unretained(this)), | 44 base::Unretained(this)), |
45 base::Bind(&AudioRendererMixerInputTest::RemoveMixer, | 45 base::Bind(&AudioRendererMixerInputTest::RemoveMixer, |
46 base::Unretained(this)), | 46 base::Unretained(this)), |
| 47 base::Bind(&AudioRendererMixerInputTest::GetOutputHWParams, |
| 48 base::Unretained(this)), |
47 device_id, url::Origin()); | 49 device_id, url::Origin()); |
48 } | 50 } |
49 | 51 |
50 AudioRendererMixer* GetMixer(const AudioParameters& params, | 52 AudioRendererMixer* GetMixer(const AudioParameters& params, |
51 const std::string& device_id, | 53 const std::string& device_id, |
52 const url::Origin& security_origin, | 54 const url::Origin& security_origin, |
53 OutputDeviceStatus* device_status) { | 55 OutputDeviceStatus* device_status) { |
54 if (device_id == kNonexistentDeviceId) { | 56 if (device_id == kNonexistentDeviceId) { |
55 if (device_status) | 57 if (device_status) |
56 *device_status = OUTPUT_DEVICE_STATUS_ERROR_NOT_FOUND; | 58 *device_status = OUTPUT_DEVICE_STATUS_ERROR_NOT_FOUND; |
(...skipping 23 matching lines...) Expand all Loading... |
80 | 82 |
81 double ProvideInput() { | 83 double ProvideInput() { |
82 return mixer_input_->ProvideInput(audio_bus_.get(), base::TimeDelta()); | 84 return mixer_input_->ProvideInput(audio_bus_.get(), base::TimeDelta()); |
83 } | 85 } |
84 | 86 |
85 MOCK_METHOD3(RemoveMixer, | 87 MOCK_METHOD3(RemoveMixer, |
86 void(const AudioParameters&, | 88 void(const AudioParameters&, |
87 const std::string&, | 89 const std::string&, |
88 const url::Origin&)); | 90 const url::Origin&)); |
89 | 91 |
| 92 MOCK_METHOD2(GetOutputHWParams, |
| 93 AudioParameters(const std::string&, const url::Origin&)); |
| 94 |
90 MOCK_METHOD1(SwitchCallbackCalled, void(OutputDeviceStatus)); | 95 MOCK_METHOD1(SwitchCallbackCalled, void(OutputDeviceStatus)); |
91 void SwitchCallback(base::RunLoop* loop, OutputDeviceStatus result) { | 96 void SwitchCallback(base::RunLoop* loop, OutputDeviceStatus result) { |
92 SwitchCallbackCalled(result); | 97 SwitchCallbackCalled(result); |
93 loop->Quit(); | 98 loop->Quit(); |
94 } | 99 } |
95 | 100 |
96 AudioRendererMixer* GetInputMixer() { return mixer_input_->mixer_; } | 101 AudioRendererMixer* GetInputMixer() { return mixer_input_->mixer_; } |
97 | 102 |
98 protected: | 103 protected: |
99 virtual ~AudioRendererMixerInputTest() {} | 104 virtual ~AudioRendererMixerInputTest() {} |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
270 EXPECT_CALL(*this, SwitchCallbackCalled(OUTPUT_DEVICE_STATUS_ERROR_INTERNAL)); | 275 EXPECT_CALL(*this, SwitchCallbackCalled(OUTPUT_DEVICE_STATUS_ERROR_INTERNAL)); |
271 mixer_input_->SwitchOutputDevice( | 276 mixer_input_->SwitchOutputDevice( |
272 kDefaultDeviceId, url::Origin(), | 277 kDefaultDeviceId, url::Origin(), |
273 base::Bind(&AudioRendererMixerInputTest::SwitchCallback, | 278 base::Bind(&AudioRendererMixerInputTest::SwitchCallback, |
274 base::Unretained(this), &run_loop)); | 279 base::Unretained(this), &run_loop)); |
275 mixer_input_->Stop(); | 280 mixer_input_->Stop(); |
276 run_loop.Run(); | 281 run_loop.Run(); |
277 } | 282 } |
278 | 283 |
279 } // namespace media | 284 } // namespace media |
OLD | NEW |