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

Unified Diff: content/renderer/media/webrtc/webrtc_local_audio_track_adapter_unittest.cc

Issue 1721273002: MediaStream audio object graph untangling and clean-ups. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed mcasas's 1st round comments, plus REBASE. Created 4 years, 10 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/webrtc/webrtc_local_audio_track_adapter_unittest.cc
diff --git a/content/renderer/media/webrtc/webrtc_local_audio_track_adapter_unittest.cc b/content/renderer/media/webrtc/webrtc_local_audio_track_adapter_unittest.cc
index 0230e0642a6a34ad78aa3808ea76a047d3358768..a34937b655ead9b867656dd403f418dfc9fc7b40 100644
--- a/content/renderer/media/webrtc/webrtc_local_audio_track_adapter_unittest.cc
+++ b/content/renderer/media/webrtc/webrtc_local_audio_track_adapter_unittest.cc
@@ -4,7 +4,7 @@
#include <stddef.h>
-#include "content/renderer/media/mock_media_constraint_factory.h"
+#include "content/renderer/media/media_stream_audio_level_calculator.h"
#include "content/renderer/media/webrtc/webrtc_local_audio_track_adapter.h"
#include "content/renderer/media/webrtc_audio_capturer.h"
#include "content/renderer/media/webrtc_local_audio_track.h"
@@ -38,11 +38,7 @@ class WebRtcLocalAudioTrackAdapterTest : public ::testing::Test {
: params_(media::AudioParameters::AUDIO_PCM_LOW_LATENCY,
media::CHANNEL_LAYOUT_STEREO, 48000, 16, 480),
adapter_(WebRtcLocalAudioTrackAdapter::Create(std::string(), NULL)) {
- MockMediaConstraintFactory constraint_factory;
- capturer_ = WebRtcAudioCapturer::CreateCapturer(
- -1, StreamDeviceInfo(MEDIA_DEVICE_AUDIO_CAPTURE, "", ""),
- constraint_factory.CreateWebMediaConstraints(), NULL, NULL);
- track_.reset(new WebRtcLocalAudioTrack(adapter_.get(), capturer_, NULL));
+ track_.reset(new WebRtcLocalAudioTrack(adapter_.get()));
}
protected:
@@ -53,7 +49,6 @@ class WebRtcLocalAudioTrackAdapterTest : public ::testing::Test {
media::AudioParameters params_;
scoped_refptr<WebRtcLocalAudioTrackAdapter> adapter_;
- scoped_refptr<WebRtcAudioCapturer> capturer_;
scoped_ptr<WebRtcLocalAudioTrack> track_;
};
@@ -79,7 +74,7 @@ TEST_F(WebRtcLocalAudioTrackAdapterTest, AddAndRemoveSink) {
EXPECT_CALL(*sink,
OnData(_, 16, params_.sample_rate(), params_.channels(),
params_.frames_per_buffer()));
- track_->Capture(*audio_bus, estimated_capture_time, false);
+ track_->Capture(*audio_bus, estimated_capture_time);
// Remove the sink from the webrtc track.
webrtc_track->RemoveSink(sink.get());
@@ -89,14 +84,19 @@ TEST_F(WebRtcLocalAudioTrackAdapterTest, AddAndRemoveSink) {
estimated_capture_time +=
params_.frames_per_buffer() * base::TimeDelta::FromSeconds(1) /
params_.sample_rate();
- track_->Capture(*audio_bus, estimated_capture_time, false);
+ track_->Capture(*audio_bus, estimated_capture_time);
}
TEST_F(WebRtcLocalAudioTrackAdapterTest, GetSignalLevel) {
webrtc::AudioTrackInterface* webrtc_track =
static_cast<webrtc::AudioTrackInterface*>(adapter_.get());
- int signal_level = 0;
+ int signal_level = -1;
+ EXPECT_FALSE(webrtc_track->GetSignalLevel(&signal_level));
+ MediaStreamAudioLevelCalculator calculator;
+ adapter_->SetLevel(calculator.level());
+ signal_level = -1;
EXPECT_TRUE(webrtc_track->GetSignalLevel(&signal_level));
+ EXPECT_EQ(0, signal_level);
}
} // namespace content

Powered by Google App Engine
This is Rietveld 408576698