OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "content/browser/media/media_internals.h" | 5 #include "content/browser/media/media_internals.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/json/json_reader.h" | 9 #include "base/json/json_reader.h" |
10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
(...skipping 12 matching lines...) Expand all Loading... |
23 | 23 |
24 class MediaInternalsTest | 24 class MediaInternalsTest |
25 : public testing::TestWithParam<media::AudioLogFactory::AudioComponent> { | 25 : public testing::TestWithParam<media::AudioLogFactory::AudioComponent> { |
26 public: | 26 public: |
27 MediaInternalsTest() | 27 MediaInternalsTest() |
28 : media_internals_(MediaInternals::GetInstance()), | 28 : media_internals_(MediaInternals::GetInstance()), |
29 update_cb_(base::Bind(&MediaInternalsTest::UpdateCallbackImpl, | 29 update_cb_(base::Bind(&MediaInternalsTest::UpdateCallbackImpl, |
30 base::Unretained(this))), | 30 base::Unretained(this))), |
31 test_params_(media::AudioParameters::AUDIO_PCM_LINEAR, | 31 test_params_(media::AudioParameters::AUDIO_PCM_LINEAR, |
32 media::CHANNEL_LAYOUT_MONO, | 32 media::CHANNEL_LAYOUT_MONO, |
| 33 0, |
33 48000, | 34 48000, |
34 16, | 35 16, |
35 128, | 36 128, |
36 media::AudioParameters::ECHO_CANCELLER | | 37 media::AudioParameters::ECHO_CANCELLER | |
37 media::AudioParameters::DUCKING), | 38 media::AudioParameters::DUCKING), |
38 test_component_(GetParam()), | 39 test_component_(GetParam()), |
39 audio_log_(media_internals_->CreateAudioLog(test_component_)) { | 40 audio_log_(media_internals_->CreateAudioLog(test_component_)) { |
40 media_internals_->AddUpdateCallback(update_cb_); | 41 media_internals_->AddUpdateCallback(update_cb_); |
41 } | 42 } |
42 | 43 |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 TEST_P(MediaInternalsTest, AudioLogCreateStartStopErrorClose) { | 90 TEST_P(MediaInternalsTest, AudioLogCreateStartStopErrorClose) { |
90 audio_log_->OnCreated( | 91 audio_log_->OnCreated( |
91 kTestComponentID, test_params_, kTestDeviceID); | 92 kTestComponentID, test_params_, kTestDeviceID); |
92 base::RunLoop().RunUntilIdle(); | 93 base::RunLoop().RunUntilIdle(); |
93 | 94 |
94 ExpectString("channel_layout", | 95 ExpectString("channel_layout", |
95 media::ChannelLayoutToString(test_params_.channel_layout())); | 96 media::ChannelLayoutToString(test_params_.channel_layout())); |
96 ExpectInt("sample_rate", test_params_.sample_rate()); | 97 ExpectInt("sample_rate", test_params_.sample_rate()); |
97 ExpectInt("frames_per_buffer", test_params_.frames_per_buffer()); | 98 ExpectInt("frames_per_buffer", test_params_.frames_per_buffer()); |
98 ExpectInt("channels", test_params_.channels()); | 99 ExpectInt("channels", test_params_.channels()); |
| 100 ExpectInt("input_channels", test_params_.input_channels()); |
99 ExpectString("effects", "ECHO_CANCELLER | DUCKING"); | 101 ExpectString("effects", "ECHO_CANCELLER | DUCKING"); |
100 ExpectString("device_id", kTestDeviceID); | 102 ExpectString("device_id", kTestDeviceID); |
101 ExpectInt("component_id", kTestComponentID); | 103 ExpectInt("component_id", kTestComponentID); |
102 ExpectInt("component_type", test_component_); | 104 ExpectInt("component_type", test_component_); |
103 ExpectStatus("created"); | 105 ExpectStatus("created"); |
104 | 106 |
105 // Verify OnStarted(). | 107 // Verify OnStarted(). |
106 audio_log_->OnStarted(kTestComponentID); | 108 audio_log_->OnStarted(kTestComponentID); |
107 base::RunLoop().RunUntilIdle(); | 109 base::RunLoop().RunUntilIdle(); |
108 ExpectStatus("started"); | 110 ExpectStatus("started"); |
(...skipping 28 matching lines...) Expand all Loading... |
137 ExpectStatus("closed"); | 139 ExpectStatus("closed"); |
138 } | 140 } |
139 | 141 |
140 INSTANTIATE_TEST_CASE_P( | 142 INSTANTIATE_TEST_CASE_P( |
141 MediaInternalsTest, MediaInternalsTest, testing::Values( | 143 MediaInternalsTest, MediaInternalsTest, testing::Values( |
142 media::AudioLogFactory::AUDIO_INPUT_CONTROLLER, | 144 media::AudioLogFactory::AUDIO_INPUT_CONTROLLER, |
143 media::AudioLogFactory::AUDIO_OUTPUT_CONTROLLER, | 145 media::AudioLogFactory::AUDIO_OUTPUT_CONTROLLER, |
144 media::AudioLogFactory::AUDIO_OUTPUT_STREAM)); | 146 media::AudioLogFactory::AUDIO_OUTPUT_STREAM)); |
145 | 147 |
146 } // namespace content | 148 } // namespace content |
OLD | NEW |