| Index: content/renderer/media/media_stream_audio_processor_unittest.cc
|
| diff --git a/content/renderer/media/media_stream_audio_processor_unittest.cc b/content/renderer/media/media_stream_audio_processor_unittest.cc
|
| index 3f46406c65366c42788536a8d6f2e943c425c7f8..ba938a6d019adcf101f9d03f4df938520dff8d2b 100644
|
| --- a/content/renderer/media/media_stream_audio_processor_unittest.cc
|
| +++ b/content/renderer/media/media_stream_audio_processor_unittest.cc
|
| @@ -11,6 +11,7 @@
|
| #include "content/public/common/content_switches.h"
|
| #include "content/public/common/media_stream_request.h"
|
| #include "content/renderer/media/media_stream_audio_processor.h"
|
| +#include "content/renderer/media/mock_media_constraint_factory.h"
|
| #include "media/audio/audio_parameters.h"
|
| #include "media/base/audio_bus.h"
|
| #include "testing/gmock/include/gmock/gmock.h"
|
| @@ -172,7 +173,7 @@ TEST_F(MediaStreamAudioProcessorTest, WithoutAudioProcessing) {
|
| }
|
|
|
| TEST_F(MediaStreamAudioProcessorTest, WithAudioProcessing) {
|
| - // Setup the audio processor with enabling the flag.
|
| + // Setup the audio processor with the flag enabled.
|
| CommandLine::ForCurrentProcess()->AppendSwitch(
|
| switches::kEnableAudioTrackProcessing);
|
| blink::WebMediaConstraints constraints;
|
| @@ -227,4 +228,30 @@ TEST_F(MediaStreamAudioProcessorTest, VerifyTabCaptureWithoutAudioProcessing) {
|
| audio_processor = NULL;
|
| }
|
|
|
| +TEST_F(MediaStreamAudioProcessorTest, TurnOffDefaultConstraints) {
|
| + // Setup the audio processor with enabling the flag.
|
| + CommandLine::ForCurrentProcess()->AppendSwitch(
|
| + switches::kEnableAudioTrackProcessing);
|
| +
|
| + // Turn off the default constraints and pass it to MediaStreamAudioProcessor.
|
| + MockMediaConstraintFactory constraint_factory;
|
| + constraint_factory.DisableDefaultAudioConstraints();
|
| + scoped_refptr<WebRtcAudioDeviceImpl> webrtc_audio_device(
|
| + new WebRtcAudioDeviceImpl());
|
| + scoped_refptr<MediaStreamAudioProcessor> audio_processor(
|
| + new talk_base::RefCountedObject<MediaStreamAudioProcessor>(
|
| + constraint_factory.CreateWebMediaConstraints(), 0,
|
| + MEDIA_DEVICE_AUDIO_CAPTURE, webrtc_audio_device.get()));
|
| + EXPECT_FALSE(audio_processor->has_audio_processing());
|
| + audio_processor->OnCaptureFormatChanged(params_);
|
| +
|
| + ProcessDataAndVerifyFormat(audio_processor,
|
| + params_.sample_rate(),
|
| + params_.channels(),
|
| + params_.sample_rate() / 100);
|
| + // Set |audio_processor| to NULL to make sure |webrtc_audio_device| outlives
|
| + // |audio_processor|.
|
| + audio_processor = NULL;
|
| +}
|
| +
|
| } // namespace content
|
|
|