Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(135)

Unified Diff: content/renderer/media/media_stream_audio_processor_unittest.cc

Issue 190643003: Fix/Add content_unittests to work for the code behind --enable-audio-track-processing (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: removed an empty line. Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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
« no previous file with comments | « content/renderer/media/media_stream_audio_processor.cc ('k') | content/renderer/media/media_stream_video_source_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698