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