OLD | NEW |
---|---|
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "base/command_line.h" | 5 #include "base/command_line.h" |
6 #include "base/file_util.h" | 6 #include "base/file_util.h" |
7 #include "base/files/file_path.h" | 7 #include "base/files/file_path.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
11 #include "content/public/common/content_switches.h" | 11 #include "content/public/common/content_switches.h" |
12 #include "content/public/common/media_stream_request.h" | 12 #include "content/public/common/media_stream_request.h" |
13 #include "content/renderer/media/media_stream_audio_processor.h" | 13 #include "content/renderer/media/media_stream_audio_processor.h" |
14 #include "content/renderer/media/mock_media_constraint_factory.h" | |
14 #include "media/audio/audio_parameters.h" | 15 #include "media/audio/audio_parameters.h" |
15 #include "media/base/audio_bus.h" | 16 #include "media/base/audio_bus.h" |
16 #include "testing/gmock/include/gmock/gmock.h" | 17 #include "testing/gmock/include/gmock/gmock.h" |
17 #include "testing/gtest/include/gtest/gtest.h" | 18 #include "testing/gtest/include/gtest/gtest.h" |
18 #include "third_party/WebKit/public/platform/WebMediaConstraints.h" | 19 #include "third_party/WebKit/public/platform/WebMediaConstraints.h" |
19 #include "third_party/libjingle/source/talk/app/webrtc/mediastreaminterface.h" | 20 #include "third_party/libjingle/source/talk/app/webrtc/mediastreaminterface.h" |
20 | 21 |
21 using ::testing::_; | 22 using ::testing::_; |
22 using ::testing::AnyNumber; | 23 using ::testing::AnyNumber; |
23 using ::testing::AtLeast; | 24 using ::testing::AtLeast; |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
220 new talk_base::RefCountedObject<MediaStreamAudioProcessor>( | 221 new talk_base::RefCountedObject<MediaStreamAudioProcessor>( |
221 constraints, 0, MEDIA_LOOPBACK_AUDIO_CAPTURE, | 222 constraints, 0, MEDIA_LOOPBACK_AUDIO_CAPTURE, |
222 webrtc_audio_device.get()); | 223 webrtc_audio_device.get()); |
223 EXPECT_FALSE(audio_processor->has_audio_processing()); | 224 EXPECT_FALSE(audio_processor->has_audio_processing()); |
224 | 225 |
225 // Set |audio_processor| to NULL to make sure |webrtc_audio_device| outlives | 226 // Set |audio_processor| to NULL to make sure |webrtc_audio_device| outlives |
226 // |audio_processor|. | 227 // |audio_processor|. |
227 audio_processor = NULL; | 228 audio_processor = NULL; |
228 } | 229 } |
229 | 230 |
231 TEST_F(MediaStreamAudioProcessorTest, TurnOffDefaultConstraints) { | |
232 // Setup the audio processor with enabling the flag. | |
phoglund_chromium
2014/03/11 14:43:21
Nit: Set up the audio processor with the flag enab
no longer working on chromium
2014/03/11 15:22:30
Done.
| |
233 CommandLine::ForCurrentProcess()->AppendSwitch( | |
234 switches::kEnableAudioTrackProcessing); | |
235 | |
236 // Turn off the default constraints and pass it to MediaStreamAudioProcessor. | |
237 MockMediaConstraintFactory constraint_factory; | |
238 constraint_factory.DisableDefaultAudioConstraints(); | |
239 scoped_refptr<WebRtcAudioDeviceImpl> webrtc_audio_device( | |
240 new WebRtcAudioDeviceImpl()); | |
241 scoped_refptr<MediaStreamAudioProcessor> audio_processor( | |
242 new talk_base::RefCountedObject<MediaStreamAudioProcessor>( | |
243 constraint_factory.CreateWebMediaConstraints(), 0, | |
244 MEDIA_DEVICE_AUDIO_CAPTURE, webrtc_audio_device.get())); | |
245 EXPECT_FALSE(audio_processor->has_audio_processing()); | |
246 audio_processor->OnCaptureFormatChanged(params_); | |
247 | |
248 ProcessDataAndVerifyFormat(audio_processor, | |
249 params_.sample_rate(), | |
250 params_.channels(), | |
251 params_.sample_rate() / 100); | |
252 // Set |audio_processor| to NULL to make sure |webrtc_audio_device| outlives | |
253 // |audio_processor|. | |
254 audio_processor = NULL; | |
255 } | |
256 | |
230 } // namespace content | 257 } // namespace content |
OLD | NEW |