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

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

Issue 2103483002: Add UMA stats for AEC filter divergence metric. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed unit test. Created 4 years, 6 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 8cf5cccdccfdd628f54456487e279673c286e8c3..0b5e138e7cb931a68a52292aba3cdde254875228 100644
--- a/content/renderer/media/media_stream_audio_processor_unittest.cc
+++ b/content/renderer/media/media_stream_audio_processor_unittest.cc
@@ -208,6 +208,7 @@ class MediaStreamAudioProcessorTest : public ::testing::Test {
#define MAYBE_WithAudioProcessing WithAudioProcessing
#endif
TEST_F(MediaStreamAudioProcessorTest, MAYBE_WithAudioProcessing) {
+ base::MessageLoop message_loop;
MockConstraintFactory constraint_factory;
scoped_refptr<WebRtcAudioDeviceImpl> webrtc_audio_device(
new WebRtcAudioDeviceImpl());
@@ -223,9 +224,10 @@ TEST_F(MediaStreamAudioProcessorTest, MAYBE_WithAudioProcessing) {
kAudioProcessingSampleRate,
kAudioProcessingNumberOfChannel,
kAudioProcessingSampleRate / 100);
- // Set |audio_processor| to NULL to make sure |webrtc_audio_device| outlives
- // |audio_processor|.
- audio_processor = NULL;
+
+ // Stop |audio_processor| so that it removes itself from
+ // |webrtc_audio_device| and clears its pointer to it.
+ audio_processor->Stop();
}
TEST_F(MediaStreamAudioProcessorTest, VerifyTabCaptureWithoutAudioProcessing) {
@@ -259,9 +261,9 @@ TEST_F(MediaStreamAudioProcessorTest, VerifyTabCaptureWithoutAudioProcessing) {
input_device_params_, webrtc_audio_device.get());
EXPECT_FALSE(audio_processor->has_audio_processing());
- // Set |audio_processor| to NULL to make sure |webrtc_audio_device| outlives
- // |audio_processor|.
- audio_processor = NULL;
+ // Stop |audio_processor| so that it removes itself from
+ // |webrtc_audio_device| and clears its pointer to it.
+ audio_processor->Stop();
}
TEST_F(MediaStreamAudioProcessorTest, TurnOffDefaultConstraints) {
@@ -281,9 +283,10 @@ TEST_F(MediaStreamAudioProcessorTest, TurnOffDefaultConstraints) {
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;
+
+ // Stop |audio_processor| so that it removes itself from
+ // |webrtc_audio_device| and clears its pointer to it.
+ audio_processor->Stop();
}
TEST_F(MediaStreamAudioProcessorTest, VerifyConstraints) {
@@ -440,6 +443,7 @@ TEST_F(MediaStreamAudioProcessorTest, SelectsConstraintsArrayGeometryIfExists) {
#define MAYBE_TestAllSampleRates TestAllSampleRates
#endif
TEST_F(MediaStreamAudioProcessorTest, MAYBE_TestAllSampleRates) {
+ base::MessageLoop message_loop;
MockConstraintFactory constraint_factory;
scoped_refptr<WebRtcAudioDeviceImpl> webrtc_audio_device(
new WebRtcAudioDeviceImpl());
@@ -467,9 +471,9 @@ TEST_F(MediaStreamAudioProcessorTest, MAYBE_TestAllSampleRates) {
kAudioProcessingSampleRate / 100);
}
- // Set |audio_processor| to NULL to make sure |webrtc_audio_device|
- // outlives |audio_processor|.
- audio_processor = NULL;
+ // Stop |audio_processor| so that it removes itself from
+ // |webrtc_audio_device| and clears its pointer to it.
+ audio_processor->Stop();
}
// Test that if we have an AEC dump message filter created, we are getting it
@@ -491,7 +495,9 @@ TEST_F(MediaStreamAudioProcessorTest, GetAecDumpMessageFilter) {
EXPECT_TRUE(audio_processor->aec_dump_message_filter_.get());
- audio_processor = NULL;
+ // Stop |audio_processor| so that it removes itself from
+ // |webrtc_audio_device| and clears its pointer to it.
+ audio_processor->Stop();
}
TEST_F(MediaStreamAudioProcessorTest, TestStereoAudio) {
@@ -549,9 +555,9 @@ TEST_F(MediaStreamAudioProcessorTest, TestStereoAudio) {
EXPECT_EQ(pushed_capture_delay, capture_delay);
}
- // Set |audio_processor| to NULL to make sure |webrtc_audio_device| outlives
- // |audio_processor|.
- audio_processor = NULL;
+ // Stop |audio_processor| so that it removes itself from
+ // |webrtc_audio_device| and clears its pointer to it.
+ audio_processor->Stop();
}
// Disabled on android clang builds due to crbug.com/470499
@@ -560,8 +566,8 @@ TEST_F(MediaStreamAudioProcessorTest, TestStereoAudio) {
#else
#define MAYBE_TestWithKeyboardMicChannel TestWithKeyboardMicChannel
#endif
-
TEST_F(MediaStreamAudioProcessorTest, MAYBE_TestWithKeyboardMicChannel) {
+ base::MessageLoop message_loop;
MockConstraintFactory constraint_factory;
constraint_factory.basic().googExperimentalNoiseSuppression.setExact(true);
scoped_refptr<WebRtcAudioDeviceImpl> webrtc_audio_device(
@@ -581,9 +587,10 @@ TEST_F(MediaStreamAudioProcessorTest, MAYBE_TestWithKeyboardMicChannel) {
kAudioProcessingSampleRate,
kAudioProcessingNumberOfChannel,
kAudioProcessingSampleRate / 100);
- // Set |audio_processor| to NULL to make sure |webrtc_audio_device| outlives
- // |audio_processor|.
- audio_processor = NULL;
+
+ // Stop |audio_processor| so that it removes itself from
+ // |webrtc_audio_device| and clears its pointer to it.
+ audio_processor->Stop();
}
} // namespace content
« no previous file with comments | « content/renderer/media/media_stream_audio_processor_options.cc ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698