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