Silencing warnings in audio send stream unit tests.
The unit tests for AudioSendStream was generating a lot of warnings about "Uninteresting mock function call" on mocked objects. This is due to the default gmock implementation being NaggyMock and there was no NiceMock override. With this change the mocks are replaced with NiceMock implementations which do not output warnings for unexpected calls. This makes the error output from the test runner much easier to visually parse to find the actual errors in failing tests. Bug: None Change-Id: Ic40db78159536ddeaa72a468fc2cb3ec17386d44 Reviewed-on: https://webrtc-review.googlesource.com/56220 Reviewed-by: Karl Wiberg <kwiberg@webrtc.org> Commit-Queue: Sebastian Jansson <srte@webrtc.org> Cr-Commit-Position: refs/heads/master@{#22152}
This commit is contained in:
parent
dfde334be0
commit
41f16bec9f
@ -84,7 +84,8 @@ std::unique_ptr<MockAudioEncoder> SetupAudioEncoderMock(
|
||||
const SdpAudioFormat& format) {
|
||||
for (const auto& spec : kCodecSpecs) {
|
||||
if (format == spec.format) {
|
||||
std::unique_ptr<MockAudioEncoder> encoder(new MockAudioEncoder);
|
||||
std::unique_ptr<MockAudioEncoder> encoder(
|
||||
new testing::NiceMock<MockAudioEncoder>());
|
||||
ON_CALL(*encoder.get(), SampleRateHz())
|
||||
.WillByDefault(Return(spec.info.sample_rate_hz));
|
||||
ON_CALL(*encoder.get(), NumChannels())
|
||||
@ -185,6 +186,7 @@ struct ConfigHelper {
|
||||
}
|
||||
|
||||
void SetupDefaultChannelProxy(bool audio_bwe_enabled) {
|
||||
EXPECT_TRUE(channel_proxy_ == nullptr);
|
||||
channel_proxy_ = new testing::StrictMock<MockVoEChannelProxy>();
|
||||
EXPECT_CALL(*channel_proxy_, GetRtpRtcp(_, _))
|
||||
.WillRepeatedly(Invoke(
|
||||
@ -303,9 +305,9 @@ struct ConfigHelper {
|
||||
AudioProcessingStats audio_processing_stats_;
|
||||
SimulatedClock simulated_clock_;
|
||||
TimeInterval active_lifetime_;
|
||||
MockRtcEventLog event_log_;
|
||||
testing::NiceMock<MockRtcEventLog> event_log_;
|
||||
RtpTransportControllerSend rtp_transport_;
|
||||
MockRtpRtcp rtp_rtcp_;
|
||||
testing::NiceMock<MockRtpRtcp> rtp_rtcp_;
|
||||
MockRtcpRttStats rtcp_rtt_stats_;
|
||||
testing::NiceMock<MockLimitObserver> limit_observer_;
|
||||
BitrateAllocator bitrate_allocator_;
|
||||
|
||||
@ -136,7 +136,7 @@ class MockVoiceDetection : public VoiceDetection {
|
||||
MOCK_CONST_METHOD0(frame_size_ms, int());
|
||||
};
|
||||
|
||||
class MockAudioProcessing : public AudioProcessing {
|
||||
class MockAudioProcessing : public testing::NiceMock<AudioProcessing> {
|
||||
public:
|
||||
MockAudioProcessing()
|
||||
: echo_cancellation_(new testing::NiceMock<MockEchoCancellation>()),
|
||||
|
||||
@ -15,12 +15,13 @@
|
||||
#include <vector>
|
||||
|
||||
#include "api/audio_codecs/audio_encoder_factory.h"
|
||||
#include "rtc_base/refcountedobject.h"
|
||||
#include "rtc_base/scoped_ref_ptr.h"
|
||||
#include "test/gmock.h"
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
class MockAudioEncoderFactory : public AudioEncoderFactory {
|
||||
class MockAudioEncoderFactory : public testing::NiceMock<AudioEncoderFactory> {
|
||||
public:
|
||||
MOCK_METHOD0(GetSupportedEncoders, std::vector<AudioCodecSpec>());
|
||||
MOCK_METHOD1(QueryAudioEncoder,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user