MockAudioEncoder: Use a dedicated marker method for test expectations

This makes the sequence of expected calls easier to read. Also, we can
save one line and get rid of a gmock warning by expecting the
MockAudioEncoder object to be destroyed at the end of the test instead
of making a final marker call.

Review URL: https://codereview.webrtc.org/1331793003

Cr-Commit-Position: refs/heads/master@{#9916}
This commit is contained in:
kwiberg
2015-09-10 05:09:45 -07:00
committed by Commit bot
parent 1dd98f3219
commit 9b66d3ba60
2 changed files with 6 additions and 6 deletions

View File

@ -115,19 +115,19 @@ TEST_F(CodecOwnerTest, ExternalEncoder) {
EXPECT_CALL(external_encoder,
EncodeInternal(0, audio, arraysize(encoded), encoded))
.WillOnce(Return(info));
EXPECT_CALL(external_encoder, Reset());
EXPECT_CALL(external_encoder, Reset());
EXPECT_CALL(external_encoder, Mark("A"));
EXPECT_CALL(external_encoder, Mark("B"));
info.encoded_timestamp = 2;
EXPECT_CALL(external_encoder,
EncodeInternal(2, audio, arraysize(encoded), encoded))
.WillOnce(Return(info));
EXPECT_CALL(external_encoder, Reset());
EXPECT_CALL(external_encoder, Die());
}
info = codec_owner_.Encoder()->Encode(0, audio, arraysize(audio),
arraysize(encoded), encoded);
EXPECT_EQ(0u, info.encoded_timestamp);
external_encoder.Reset(); // Dummy call to mark the sequence of expectations.
external_encoder.Mark("A");
// Change to internal encoder.
CodecInst codec_inst = kDefaultCodecInst;
@ -136,14 +136,13 @@ TEST_F(CodecOwnerTest, ExternalEncoder) {
// Don't expect any more calls to the external encoder.
info = codec_owner_.Encoder()->Encode(1, audio, arraysize(audio),
arraysize(encoded), encoded);
external_encoder.Reset(); // Dummy call to mark the sequence of expectations.
external_encoder.Mark("B");
// Change back to external encoder again.
codec_owner_.SetEncoders(&external_encoder, -1, VADNormal, -1);
info = codec_owner_.Encoder()->Encode(2, audio, arraysize(audio),
arraysize(encoded), encoded);
EXPECT_EQ(2u, info.encoded_timestamp);
external_encoder.Reset(); // Dummy call to mark the sequence of expectations.
}
} // namespace acm2