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

Unified Diff: webrtc/media/engine/webrtcvoiceengine_unittest.cc

Issue 2353033005: Refactoring: move ownership of RtcEventLog from Call to PeerConnection (Closed)
Patch Set: Updated unit tests to use RtcEventLogNullImpl. Created 4 years, 2 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: webrtc/media/engine/webrtcvoiceengine_unittest.cc
diff --git a/webrtc/media/engine/webrtcvoiceengine_unittest.cc b/webrtc/media/engine/webrtcvoiceengine_unittest.cc
index 8be3b9d2497fa463d79915ee4bd37508e2d807b7..910f10c4fe84f515d0ba35ff1d6084f1797de1d2 100644
--- a/webrtc/media/engine/webrtcvoiceengine_unittest.cc
+++ b/webrtc/media/engine/webrtcvoiceengine_unittest.cc
@@ -17,6 +17,7 @@
#include "webrtc/call.h"
#include "webrtc/p2p/base/faketransportcontroller.h"
#include "webrtc/test/field_trial.h"
+#include "webrtc/logging/rtc_event_log/rtc_event_log.h"
#include "webrtc/media/base/fakemediaengine.h"
#include "webrtc/media/base/fakenetworkinterface.h"
#include "webrtc/media/base/fakertp.h"
@@ -62,6 +63,13 @@ class FakeVoEWrapper : public cricket::VoEWrapper {
engine) { // volume
}
};
+
+webrtc::Call::Config ConfigWithRtcEventLog(webrtc::RtcEventLog* event_log) {
+ webrtc::Call::Config config;
+ config.event_log = event_log;
+ return config;
+}
+
} // namespace
// Tests that our stub library "works".
@@ -97,7 +105,8 @@ class WebRtcVoiceEngineTestFake : public testing::Test {
WebRtcVoiceEngineTestFake() : WebRtcVoiceEngineTestFake("") {}
explicit WebRtcVoiceEngineTestFake(const char* field_trials)
- : call_(webrtc::Call::Config()), override_field_trials_(field_trials) {
+ : call_(ConfigWithRtcEventLog(&event_log_)),
+ override_field_trials_(field_trials) {
auto factory = webrtc::MockAudioDecoderFactory::CreateUnusedFactory();
EXPECT_CALL(adm_, AddRef()).WillOnce(Return(0));
EXPECT_CALL(adm_, Release()).WillOnce(Return(0));
@@ -492,6 +501,7 @@ class WebRtcVoiceEngineTestFake : public testing::Test {
protected:
StrictMock<webrtc::test::MockAudioDeviceModule> adm_;
+ webrtc::RtcEventLogNullImpl event_log_;
cricket::FakeCall call_;
cricket::FakeWebRtcVoiceEngine voe_;
std::unique_ptr<cricket::WebRtcVoiceEngine> engine_;
@@ -3361,8 +3371,9 @@ TEST(WebRtcVoiceEngineTest, StartupShutdown) {
// we never want it to create a decoder at this stage.
cricket::WebRtcVoiceEngine engine(
nullptr, webrtc::MockAudioDecoderFactory::CreateUnusedFactory());
+ webrtc::RtcEventLogNullImpl event_log;
std::unique_ptr<webrtc::Call> call(
- webrtc::Call::Create(webrtc::Call::Config()));
+ webrtc::Call::Create(ConfigWithRtcEventLog(&event_log)));
cricket::VoiceMediaChannel* channel = engine.CreateChannel(
call.get(), cricket::MediaConfig(), cricket::AudioOptions());
EXPECT_TRUE(channel != nullptr);
@@ -3377,8 +3388,9 @@ TEST(WebRtcVoiceEngineTest, StartupShutdownWithExternalADM) {
{
cricket::WebRtcVoiceEngine engine(
&adm, webrtc::MockAudioDecoderFactory::CreateUnusedFactory());
+ webrtc::RtcEventLogNullImpl event_log;
std::unique_ptr<webrtc::Call> call(
- webrtc::Call::Create(webrtc::Call::Config()));
+ webrtc::Call::Create(ConfigWithRtcEventLog(&event_log)));
cricket::VoiceMediaChannel* channel = engine.CreateChannel(
call.get(), cricket::MediaConfig(), cricket::AudioOptions());
EXPECT_TRUE(channel != nullptr);
@@ -3475,8 +3487,9 @@ TEST(WebRtcVoiceEngineTest, HasCorrectCodecs) {
TEST(WebRtcVoiceEngineTest, Has32Channels) {
cricket::WebRtcVoiceEngine engine(
nullptr, webrtc::MockAudioDecoderFactory::CreateUnusedFactory());
+ webrtc::RtcEventLogNullImpl event_log;
std::unique_ptr<webrtc::Call> call(
- webrtc::Call::Create(webrtc::Call::Config()));
+ webrtc::Call::Create(ConfigWithRtcEventLog(&event_log)));
cricket::VoiceMediaChannel* channels[32];
int num_channels = 0;
@@ -3507,8 +3520,9 @@ TEST(WebRtcVoiceEngineTest, SetRecvCodecs) {
// I think it will become clear once audio decoder injection is completed.
cricket::WebRtcVoiceEngine engine(
nullptr, webrtc::CreateBuiltinAudioDecoderFactory());
+ webrtc::RtcEventLogNullImpl event_log;
std::unique_ptr<webrtc::Call> call(
- webrtc::Call::Create(webrtc::Call::Config()));
+ webrtc::Call::Create(ConfigWithRtcEventLog(&event_log)));
cricket::WebRtcVoiceMediaChannel channel(&engine, cricket::MediaConfig(),
cricket::AudioOptions(), call.get());
cricket::AudioRecvParameters parameters;

Powered by Google App Engine
This is Rietveld 408576698