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, |
| 37 media::AudioParameters::ECHO_CANCELLER | |
| 38 media::AudioParameters::DUCKING), |
36 test_component_(GetParam()), | 39 test_component_(GetParam()), |
37 audio_log_(media_internals_->CreateAudioLog(test_component_)) { | 40 audio_log_(media_internals_->CreateAudioLog(test_component_)) { |
38 media_internals_->AddUpdateCallback(update_cb_); | 41 media_internals_->AddUpdateCallback(update_cb_); |
39 } | 42 } |
40 | 43 |
41 virtual ~MediaInternalsTest() { | 44 virtual ~MediaInternalsTest() { |
42 media_internals_->RemoveUpdateCallback(update_cb_); | 45 media_internals_->RemoveUpdateCallback(update_cb_); |
43 } | 46 } |
44 | 47 |
45 protected: | 48 protected: |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 audio_log_->OnCreated( | 91 audio_log_->OnCreated( |
89 kTestComponentID, test_params_, kTestDeviceID); | 92 kTestComponentID, test_params_, kTestDeviceID); |
90 base::RunLoop().RunUntilIdle(); | 93 base::RunLoop().RunUntilIdle(); |
91 | 94 |
92 ExpectString("channel_layout", | 95 ExpectString("channel_layout", |
93 media::ChannelLayoutToString(test_params_.channel_layout())); | 96 media::ChannelLayoutToString(test_params_.channel_layout())); |
94 ExpectInt("sample_rate", test_params_.sample_rate()); | 97 ExpectInt("sample_rate", test_params_.sample_rate()); |
95 ExpectInt("frames_per_buffer", test_params_.frames_per_buffer()); | 98 ExpectInt("frames_per_buffer", test_params_.frames_per_buffer()); |
96 ExpectInt("channels", test_params_.channels()); | 99 ExpectInt("channels", test_params_.channels()); |
97 ExpectInt("input_channels", test_params_.input_channels()); | 100 ExpectInt("input_channels", test_params_.input_channels()); |
| 101 ExpectString("effects", "ECHO_CANCELLER | DUCKING"); |
98 ExpectString("device_id", kTestDeviceID); | 102 ExpectString("device_id", kTestDeviceID); |
99 ExpectInt("component_id", kTestComponentID); | 103 ExpectInt("component_id", kTestComponentID); |
100 ExpectInt("component_type", test_component_); | 104 ExpectInt("component_type", test_component_); |
101 ExpectStatus("created"); | 105 ExpectStatus("created"); |
102 | 106 |
103 // Verify OnStarted(). | 107 // Verify OnStarted(). |
104 audio_log_->OnStarted(kTestComponentID); | 108 audio_log_->OnStarted(kTestComponentID); |
105 base::RunLoop().RunUntilIdle(); | 109 base::RunLoop().RunUntilIdle(); |
106 ExpectStatus("started"); | 110 ExpectStatus("started"); |
107 | 111 |
(...skipping 27 matching lines...) Expand all Loading... |
135 ExpectStatus("closed"); | 139 ExpectStatus("closed"); |
136 } | 140 } |
137 | 141 |
138 INSTANTIATE_TEST_CASE_P( | 142 INSTANTIATE_TEST_CASE_P( |
139 MediaInternalsTest, MediaInternalsTest, testing::Values( | 143 MediaInternalsTest, MediaInternalsTest, testing::Values( |
140 media::AudioLogFactory::AUDIO_INPUT_CONTROLLER, | 144 media::AudioLogFactory::AUDIO_INPUT_CONTROLLER, |
141 media::AudioLogFactory::AUDIO_OUTPUT_CONTROLLER, | 145 media::AudioLogFactory::AUDIO_OUTPUT_CONTROLLER, |
142 media::AudioLogFactory::AUDIO_OUTPUT_STREAM)); | 146 media::AudioLogFactory::AUDIO_OUTPUT_STREAM)); |
143 | 147 |
144 } // namespace content | 148 } // namespace content |
OLD | NEW |