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

Side by Side Diff: media/engine/webrtcvoiceengine_unittest.cc

Issue 3020493002: Remove AudioDeviceObserver and make ADM not inherit from the Module interface.
Patch Set: linux build error Created 3 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2008 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2008 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 3320 matching lines...) Expand 10 before | Expand all | Expand 10 after
3331 call.get(), cricket::MediaConfig(), cricket::AudioOptions()); 3331 call.get(), cricket::MediaConfig(), cricket::AudioOptions());
3332 EXPECT_TRUE(channel != nullptr); 3332 EXPECT_TRUE(channel != nullptr);
3333 delete channel; 3333 delete channel;
3334 } 3334 }
3335 3335
3336 // Tests that reference counting on the external ADM is correct. 3336 // Tests that reference counting on the external ADM is correct.
3337 TEST(WebRtcVoiceEngineTest, StartupShutdownWithExternalADM) { 3337 TEST(WebRtcVoiceEngineTest, StartupShutdownWithExternalADM) {
3338 testing::NiceMock<webrtc::test::MockAudioDeviceModule> adm; 3338 testing::NiceMock<webrtc::test::MockAudioDeviceModule> adm;
3339 EXPECT_CALL(adm, AddRef()).Times(3).WillRepeatedly(Return(0)); 3339 EXPECT_CALL(adm, AddRef()).Times(3).WillRepeatedly(Return(0));
3340 EXPECT_CALL(adm, Release()).Times(3).WillRepeatedly(Return(0)); 3340 EXPECT_CALL(adm, Release()).Times(3).WillRepeatedly(Return(0));
3341 // Return 100ms just in case this function gets called. If we don't,
3342 // we could enter a tight loop since the mock would return 0.
3343 EXPECT_CALL(adm, TimeUntilNextProcess()).WillRepeatedly(Return(100));
3344 { 3341 {
3345 rtc::scoped_refptr<webrtc::AudioProcessing> apm = 3342 rtc::scoped_refptr<webrtc::AudioProcessing> apm =
3346 webrtc::AudioProcessing::Create(); 3343 webrtc::AudioProcessing::Create();
3347 cricket::WebRtcVoiceEngine engine( 3344 cricket::WebRtcVoiceEngine engine(
3348 &adm, webrtc::MockAudioEncoderFactory::CreateUnusedFactory(), 3345 &adm, webrtc::MockAudioEncoderFactory::CreateUnusedFactory(),
3349 webrtc::MockAudioDecoderFactory::CreateUnusedFactory(), nullptr, apm); 3346 webrtc::MockAudioDecoderFactory::CreateUnusedFactory(), nullptr, apm);
3350 engine.Init(); 3347 engine.Init();
3351 webrtc::RtcEventLogNullImpl event_log; 3348 webrtc::RtcEventLogNullImpl event_log;
3352 std::unique_ptr<webrtc::Call> call( 3349 std::unique_ptr<webrtc::Call> call(
3353 webrtc::Call::Create(webrtc::Call::Config(&event_log))); 3350 webrtc::Call::Create(webrtc::Call::Config(&event_log)));
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
3530 // Without this cast, the comparison turned unsigned and, thus, failed for -1. 3527 // Without this cast, the comparison turned unsigned and, thus, failed for -1.
3531 const int num_specs = static_cast<int>(specs.size()); 3528 const int num_specs = static_cast<int>(specs.size());
3532 EXPECT_GE(find_codec({"cn", 8000, 1}), num_specs); 3529 EXPECT_GE(find_codec({"cn", 8000, 1}), num_specs);
3533 EXPECT_GE(find_codec({"cn", 16000, 1}), num_specs); 3530 EXPECT_GE(find_codec({"cn", 16000, 1}), num_specs);
3534 EXPECT_EQ(find_codec({"cn", 32000, 1}), -1); 3531 EXPECT_EQ(find_codec({"cn", 32000, 1}), -1);
3535 EXPECT_GE(find_codec({"telephone-event", 8000, 1}), num_specs); 3532 EXPECT_GE(find_codec({"telephone-event", 8000, 1}), num_specs);
3536 EXPECT_GE(find_codec({"telephone-event", 16000, 1}), num_specs); 3533 EXPECT_GE(find_codec({"telephone-event", 16000, 1}), num_specs);
3537 EXPECT_GE(find_codec({"telephone-event", 32000, 1}), num_specs); 3534 EXPECT_GE(find_codec({"telephone-event", 32000, 1}), num_specs);
3538 EXPECT_GE(find_codec({"telephone-event", 48000, 1}), num_specs); 3535 EXPECT_GE(find_codec({"telephone-event", 48000, 1}), num_specs);
3539 } 3536 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698