Skip to content

Commit

Permalink
Convert WebRtcVoiceEngine tests to rtc::make_ref_counted
Browse files Browse the repository at this point in the history
Bug: webrtc:12701
Change-Id: I8d6fb12a657c61112415aeffb25f177c1c81f03a
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/229589
Reviewed-by: Per Åhgren <peah@webrtc.org>
Commit-Queue: Niels Moller <nisse@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#34960}
  • Loading branch information
Niels Möller authored and WebRTC LUCI CQ committed Sep 9, 2021
1 parent 66e0605 commit fb50179
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions media/engine/webrtc_voice_engine_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ TEST(WebRtcVoiceEngineTestStubLibrary, StartupShutdown) {
AdmSetupExpectations(adm);
rtc::scoped_refptr<StrictMock<webrtc::test::MockAudioProcessing>> apm =
use_null_apm ? nullptr
: new rtc::RefCountedObject<
: rtc::make_ref_counted<
StrictMock<webrtc::test::MockAudioProcessing>>();

webrtc::AudioProcessing::Config apm_config;
Expand Down Expand Up @@ -188,7 +188,7 @@ class WebRtcVoiceEngineTestFake : public ::testing::TestWithParam<bool> {
adm_(webrtc::test::MockAudioDeviceModule::CreateStrict()),
apm_(use_null_apm_
? nullptr
: new rtc::RefCountedObject<
: rtc::make_ref_counted<
StrictMock<webrtc::test::MockAudioProcessing>>()),
call_(),
override_field_trials_(field_trials) {
Expand Down Expand Up @@ -3656,10 +3656,8 @@ TEST(WebRtcVoiceEngineTest, StartupShutdownWithExternalADM) {
for (bool use_null_apm : {false, true}) {
std::unique_ptr<webrtc::TaskQueueFactory> task_queue_factory =
webrtc::CreateDefaultTaskQueueFactory();
rtc::scoped_refptr<rtc::RefCountedObject<
::testing::NiceMock<webrtc::test::MockAudioDeviceModule>>>
adm(new rtc::RefCountedObject<
::testing::NiceMock<webrtc::test::MockAudioDeviceModule>>());
auto adm = rtc::make_ref_counted<
::testing::NiceMock<webrtc::test::MockAudioDeviceModule>>();
{
rtc::scoped_refptr<webrtc::AudioProcessing> apm =
use_null_apm ? nullptr : webrtc::AudioProcessingBuilder().Create();
Expand All @@ -3682,7 +3680,8 @@ TEST(WebRtcVoiceEngineTest, StartupShutdownWithExternalADM) {
delete channel;
}
// The engine/channel should have dropped their references.
EXPECT_TRUE(adm->HasOneRef());
EXPECT_EQ(adm.release()->Release(),
rtc::RefCountReleaseStatus::kDroppedLastRef);
}
}

Expand Down Expand Up @@ -3844,7 +3843,7 @@ TEST(WebRtcVoiceEngineTest, CollectRecvCodecs) {
rtc::scoped_refptr<webrtc::MockAudioEncoderFactory> unused_encoder_factory =
webrtc::MockAudioEncoderFactory::CreateUnusedFactory();
rtc::scoped_refptr<webrtc::MockAudioDecoderFactory> mock_decoder_factory =
new rtc::RefCountedObject<webrtc::MockAudioDecoderFactory>;
rtc::make_ref_counted<webrtc::MockAudioDecoderFactory>();
EXPECT_CALL(*mock_decoder_factory.get(), GetSupportedDecoders())
.WillOnce(Return(specs));
rtc::scoped_refptr<webrtc::test::MockAudioDeviceModule> adm =
Expand Down

0 comments on commit fb50179

Please sign in to comment.