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