Removed Die mock from MockAudioEncoder
MockAudioEncoder was calling a mocked Die function on itself in its destructor. This outputs "Uninteresting mock function call" warning if the Die call was not expected. This is true even if a NiceMock is used to suppress the warnings. The purpose of testing that the destructor is called might be to protect against memory leaks when audio encoder ownership is transferred using a raw pointer. However, this case is already covered by msan checks. Bug: None Change-Id: I0603c417b4b239027859228e05ebcf83ff5aaf18 Reviewed-on: https://webrtc-review.googlesource.com/56183 Reviewed-by: Karl Wiberg <kwiberg@webrtc.org> Reviewed-by: Henrik Lundin <henrik.lundin@webrtc.org> Commit-Queue: Sebastian Jansson <srte@webrtc.org> Cr-Commit-Position: refs/heads/master@{#22146}
This commit is contained in:

committed by
Commit Bot

parent
5283022790
commit
5d436ac0bf
@ -65,7 +65,6 @@ struct AudioEncoderFakeApi {
|
|||||||
auto enc = rtc::MakeUnique<testing::StrictMock<MockAudioEncoder>>();
|
auto enc = rtc::MakeUnique<testing::StrictMock<MockAudioEncoder>>();
|
||||||
EXPECT_CALL(*enc, SampleRateHz())
|
EXPECT_CALL(*enc, SampleRateHz())
|
||||||
.WillOnce(testing::Return(Params::CodecInfo().sample_rate_hz));
|
.WillOnce(testing::Return(Params::CodecInfo().sample_rate_hz));
|
||||||
EXPECT_CALL(*enc, Die());
|
|
||||||
return std::move(enc);
|
return std::move(enc);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -1811,7 +1811,6 @@ TEST_F(AcmSenderBitExactnessOldApi, External_Pcmu_20ms) {
|
|||||||
MockAudioEncoder mock_encoder;
|
MockAudioEncoder mock_encoder;
|
||||||
// Set expectations on the mock encoder and also delegate the calls to the
|
// Set expectations on the mock encoder and also delegate the calls to the
|
||||||
// real encoder.
|
// real encoder.
|
||||||
EXPECT_CALL(mock_encoder, Die());
|
|
||||||
EXPECT_CALL(mock_encoder, SampleRateHz())
|
EXPECT_CALL(mock_encoder, SampleRateHz())
|
||||||
.Times(AtLeast(1))
|
.Times(AtLeast(1))
|
||||||
.WillRepeatedly(Invoke(&encoder, &AudioEncoderPcmU::SampleRateHz));
|
.WillRepeatedly(Invoke(&encoder, &AudioEncoderPcmU::SampleRateHz));
|
||||||
|
@ -28,7 +28,6 @@ std::unique_ptr<MockAudioEncoder> CreateMockEncoder() {
|
|||||||
EXPECT_CALL(*enc, SampleRateHz()).WillRepeatedly(Return(8000));
|
EXPECT_CALL(*enc, SampleRateHz()).WillRepeatedly(Return(8000));
|
||||||
EXPECT_CALL(*enc, NumChannels()).WillRepeatedly(Return(1));
|
EXPECT_CALL(*enc, NumChannels()).WillRepeatedly(Return(1));
|
||||||
EXPECT_CALL(*enc, Max10MsFramesInAPacket()).WillRepeatedly(Return(1));
|
EXPECT_CALL(*enc, Max10MsFramesInAPacket()).WillRepeatedly(Return(1));
|
||||||
EXPECT_CALL(*enc, Die());
|
|
||||||
return enc;
|
return enc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -137,7 +137,6 @@ TEST(RentACodecTest, ExternalEncoder) {
|
|||||||
.WillOnce(Return(info));
|
.WillOnce(Return(info));
|
||||||
EXPECT_CALL(marker, Mark("A"));
|
EXPECT_CALL(marker, Mark("A"));
|
||||||
EXPECT_CALL(marker, Mark("B"));
|
EXPECT_CALL(marker, Mark("B"));
|
||||||
EXPECT_CALL(*external_encoder, Die());
|
|
||||||
EXPECT_CALL(marker, Mark("C"));
|
EXPECT_CALL(marker, Mark("C"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -180,11 +179,9 @@ void TestCngAndRedResetSpeechEncoder(bool use_cng, bool use_red) {
|
|||||||
{
|
{
|
||||||
::testing::InSequence s;
|
::testing::InSequence s;
|
||||||
EXPECT_CALL(marker, Mark("disabled"));
|
EXPECT_CALL(marker, Mark("disabled"));
|
||||||
EXPECT_CALL(*speech_encoder1, Die());
|
|
||||||
EXPECT_CALL(marker, Mark("enabled"));
|
EXPECT_CALL(marker, Mark("enabled"));
|
||||||
if (use_cng || use_red)
|
if (use_cng || use_red)
|
||||||
EXPECT_CALL(*speech_encoder2, Reset());
|
EXPECT_CALL(*speech_encoder2, Reset());
|
||||||
EXPECT_CALL(*speech_encoder2, Die());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
RentACodec::StackParameters param1, param2;
|
RentACodec::StackParameters param1, param2;
|
||||||
|
@ -43,7 +43,6 @@ class AudioEncoderCngTest : public ::testing::Test {
|
|||||||
sample_rate_hz_(8000) {
|
sample_rate_hz_(8000) {
|
||||||
memset(audio_, 0, kMaxNumSamples * 2);
|
memset(audio_, 0, kMaxNumSamples * 2);
|
||||||
EXPECT_CALL(*mock_encoder_, NumChannels()).WillRepeatedly(Return(1));
|
EXPECT_CALL(*mock_encoder_, NumChannels()).WillRepeatedly(Return(1));
|
||||||
EXPECT_CALL(*mock_encoder_, Die()).Times(1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void TearDown() override {
|
void TearDown() override {
|
||||||
|
@ -49,7 +49,6 @@ class AudioEncoderCopyRedTest : public ::testing::Test {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void TearDown() override {
|
void TearDown() override {
|
||||||
EXPECT_CALL(*mock_encoder_, Die()).Times(1);
|
|
||||||
red_.reset();
|
red_.reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -13,9 +13,7 @@
|
|||||||
namespace webrtc {
|
namespace webrtc {
|
||||||
|
|
||||||
MockAudioEncoder::MockAudioEncoder() = default;
|
MockAudioEncoder::MockAudioEncoder() = default;
|
||||||
MockAudioEncoder::~MockAudioEncoder() {
|
MockAudioEncoder::~MockAudioEncoder() = default;
|
||||||
Die();
|
|
||||||
}
|
|
||||||
|
|
||||||
MockAudioEncoder::FakeEncoding::FakeEncoding(
|
MockAudioEncoder::FakeEncoding::FakeEncoding(
|
||||||
const AudioEncoder::EncodedInfo& info)
|
const AudioEncoder::EncodedInfo& info)
|
||||||
|
@ -27,7 +27,6 @@ class MockAudioEncoder : public AudioEncoder {
|
|||||||
// http://crbug.com/428099.
|
// http://crbug.com/428099.
|
||||||
MockAudioEncoder();
|
MockAudioEncoder();
|
||||||
~MockAudioEncoder();
|
~MockAudioEncoder();
|
||||||
MOCK_METHOD0(Die, void());
|
|
||||||
MOCK_METHOD1(Mark, void(std::string desc));
|
MOCK_METHOD1(Mark, void(std::string desc));
|
||||||
MOCK_CONST_METHOD0(SampleRateHz, int());
|
MOCK_CONST_METHOD0(SampleRateHz, int());
|
||||||
MOCK_CONST_METHOD0(NumChannels, size_t());
|
MOCK_CONST_METHOD0(NumChannels, size_t());
|
||||||
|
Reference in New Issue
Block a user