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

Side by Side Diff: webrtc/modules/audio_coding/neteq/neteq_impl_unittest.cc

Issue 2276913002: DecoderDatabase: Made several methods nonvirtual to minimize mockable interface (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Turned DecoderInfo factory into a raw pointer. Removed two unnecessary comments. Created 4 years, 3 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) 2012 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2012 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 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 kFirstTimestamp, kFirstReceiveTime)); 262 kFirstTimestamp, kFirstReceiveTime));
263 // BWE update function called with second packet. 263 // BWE update function called with second packet.
264 EXPECT_CALL( 264 EXPECT_CALL(
265 *mock_decoder, 265 *mock_decoder,
266 IncomingPacket(_, kPayloadLength, kFirstSequenceNumber + 1, 266 IncomingPacket(_, kPayloadLength, kFirstSequenceNumber + 1,
267 kFirstTimestamp + 160, kFirstReceiveTime + 155)); 267 kFirstTimestamp + 160, kFirstReceiveTime + 155));
268 EXPECT_CALL(*mock_decoder, Die()).Times(1); // Called when deleted. 268 EXPECT_CALL(*mock_decoder, Die()).Times(1); // Called when deleted.
269 269
270 *dec = std::move(mock_decoder); 270 *dec = std::move(mock_decoder);
271 })); 271 }));
272 DecoderDatabase::DecoderInfo info(NetEqDecoder::kDecoderPCMu, ""); 272 DecoderDatabase::DecoderInfo info(NetEqDecoder::kDecoderPCMu, "",
273 mock_decoder_factory);
273 274
274 // Expectations for decoder database. 275 // Expectations for decoder database.
275 EXPECT_CALL(*mock_decoder_database_, IsRed(kPayloadType))
276 .WillRepeatedly(Return(false)); // This is not RED.
277 EXPECT_CALL(*mock_decoder_database_, CheckPayloadTypes(_))
278 .Times(2)
279 .WillRepeatedly(Return(DecoderDatabase::kOK)); // Payload type is valid.
280 EXPECT_CALL(*mock_decoder_database_, IsDtmf(kPayloadType))
281 .WillRepeatedly(Return(false)); // This is not DTMF.
282 EXPECT_CALL(*mock_decoder_database_, GetDecoder(kPayloadType))
283 .Times(3)
284 .WillRepeatedly(
285 Invoke([&info, mock_decoder_factory](uint8_t payload_type) {
286 return info.GetDecoder(mock_decoder_factory);
287 }));
288 EXPECT_CALL(*mock_decoder_database_, IsComfortNoise(kPayloadType))
289 .WillRepeatedly(Return(false)); // This is not CNG.
290 EXPECT_CALL(*mock_decoder_database_, GetDecoderInfo(kPayloadType)) 276 EXPECT_CALL(*mock_decoder_database_, GetDecoderInfo(kPayloadType))
291 .WillRepeatedly(Return(&info)); 277 .WillRepeatedly(Return(&info));
292 278
293 // Expectations for packet buffer. 279 // Expectations for packet buffer.
294 EXPECT_CALL(*mock_packet_buffer_, NumPacketsInBuffer()) 280 EXPECT_CALL(*mock_packet_buffer_, NumPacketsInBuffer())
295 .WillOnce(Return(0)) // First packet. 281 .WillOnce(Return(0)) // First packet.
296 .WillOnce(Return(1)) // Second packet. 282 .WillOnce(Return(1)) // Second packet.
297 .WillOnce(Return(2)); // Second packet, checking after it was inserted. 283 .WillOnce(Return(2)); // Second packet, checking after it was inserted.
298 EXPECT_CALL(*mock_packet_buffer_, Empty()) 284 EXPECT_CALL(*mock_packet_buffer_, Empty())
299 .WillOnce(Return(false)); // Called once after first packet is inserted. 285 .WillOnce(Return(false)); // Called once after first packet is inserted.
(...skipping 1142 matching lines...) Expand 10 before | Expand all | Expand 10 after
1442 EXPECT_CALL(*mock_delay_manager_, BufferLimits(_, _)) 1428 EXPECT_CALL(*mock_delay_manager_, BufferLimits(_, _))
1443 .Times(1) 1429 .Times(1)
1444 .WillOnce(DoAll(SetArgPointee<0>(1), SetArgPointee<1>(2))); 1430 .WillOnce(DoAll(SetArgPointee<0>(1), SetArgPointee<1>(2)));
1445 1431
1446 bool muted; 1432 bool muted;
1447 EXPECT_EQ(NetEq::kOK, neteq_->GetAudio(&output_, &muted)); 1433 EXPECT_EQ(NetEq::kOK, neteq_->GetAudio(&output_, &muted));
1448 EXPECT_EQ(kAccelerate, neteq_->last_operation_for_test()); 1434 EXPECT_EQ(kAccelerate, neteq_->last_operation_for_test());
1449 } 1435 }
1450 1436
1451 }// namespace webrtc 1437 }// namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698