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

Side by Side Diff: webrtc/call/rtp_demuxer_unittest.cc

Issue 3003133002: Fix an implicit narrowing conversion found by MSVC (Closed)
Patch Set: with roll Created 3 years, 4 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) 2017 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2017 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 328 matching lines...) Expand 10 before | Expand all | Expand 10 after
339 } 339 }
340 340
341 TEST_F(RtpDemuxerTest, OnRtpPacketCalledOnCorrectSinkByRsid) { 341 TEST_F(RtpDemuxerTest, OnRtpPacketCalledOnCorrectSinkByRsid) {
342 const std::string rsids[] = {"a", "b", "c"}; 342 const std::string rsids[] = {"a", "b", "c"};
343 MockRtpPacketSink sinks[arraysize(rsids)]; 343 MockRtpPacketSink sinks[arraysize(rsids)];
344 for (size_t i = 0; i < arraysize(rsids); i++) { 344 for (size_t i = 0; i < arraysize(rsids); i++) {
345 AddSinkOnlyRsid(rsids[i], &sinks[i]); 345 AddSinkOnlyRsid(rsids[i], &sinks[i]);
346 } 346 }
347 347
348 for (size_t i = 0; i < arraysize(rsids); i++) { 348 for (size_t i = 0; i < arraysize(rsids); i++) {
349 auto packet = CreatePacketWithSsrcRsid(i, rsids[i]); 349 auto packet = CreatePacketWithSsrcRsid(rtc::dchecked_cast<uint32_t>(i),
kwiberg-webrtc 2017/08/22 20:06:05 There's almost never a reason to use DCHECK instea
oprypin_webrtc 2017/08/22 20:28:39 Done.
350 rsids[i]);
350 EXPECT_CALL(sinks[i], OnRtpPacket(SamePacketAs(*packet))).Times(1); 351 EXPECT_CALL(sinks[i], OnRtpPacket(SamePacketAs(*packet))).Times(1);
351 EXPECT_TRUE(demuxer_.OnRtpPacket(*packet)); 352 EXPECT_TRUE(demuxer_.OnRtpPacket(*packet));
352 } 353 }
353 } 354 }
354 355
355 TEST_F(RtpDemuxerTest, OnRtpPacketCalledOnCorrectSinkByMid) { 356 TEST_F(RtpDemuxerTest, OnRtpPacketCalledOnCorrectSinkByMid) {
356 const std::string mids[] = {"a", "v", "s"}; 357 const std::string mids[] = {"a", "v", "s"};
357 MockRtpPacketSink sinks[arraysize(mids)]; 358 MockRtpPacketSink sinks[arraysize(mids)];
358 for (size_t i = 0; i < arraysize(mids); i++) { 359 for (size_t i = 0; i < arraysize(mids); i++) {
359 AddSinkOnlyMid(mids[i], &sinks[i]); 360 AddSinkOnlyMid(mids[i], &sinks[i]);
360 } 361 }
361 362
362 for (size_t i = 0; i < arraysize(mids); i++) { 363 for (size_t i = 0; i < arraysize(mids); i++) {
363 auto packet = CreatePacketWithSsrcMid(i, mids[i]); 364 auto packet = CreatePacketWithSsrcMid(rtc::dchecked_cast<uint32_t>(i),
365 mids[i]);
364 EXPECT_CALL(sinks[i], OnRtpPacket(SamePacketAs(*packet))).Times(1); 366 EXPECT_CALL(sinks[i], OnRtpPacket(SamePacketAs(*packet))).Times(1);
365 EXPECT_TRUE(demuxer_.OnRtpPacket(*packet)); 367 EXPECT_TRUE(demuxer_.OnRtpPacket(*packet));
366 } 368 }
367 } 369 }
368 370
369 TEST_F(RtpDemuxerTest, OnRtpPacketCalledOnCorrectSinkByMidAndRsid) { 371 TEST_F(RtpDemuxerTest, OnRtpPacketCalledOnCorrectSinkByMidAndRsid) {
370 const std::string mid = "v"; 372 const std::string mid = "v";
371 const std::string rsid = "1"; 373 const std::string rsid = "1";
372 constexpr uint32_t ssrc = 10; 374 constexpr uint32_t ssrc = 10;
373 375
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
407 } 409 }
408 410
409 TEST_F(RtpDemuxerTest, PacketsDeliveredInRightOrder) { 411 TEST_F(RtpDemuxerTest, PacketsDeliveredInRightOrder) {
410 constexpr uint32_t ssrc = 101; 412 constexpr uint32_t ssrc = 101;
411 MockRtpPacketSink sink; 413 MockRtpPacketSink sink;
412 AddSinkOnlySsrc(ssrc, &sink); 414 AddSinkOnlySsrc(ssrc, &sink);
413 415
414 std::unique_ptr<RtpPacketReceived> packets[5]; 416 std::unique_ptr<RtpPacketReceived> packets[5];
415 for (size_t i = 0; i < arraysize(packets); i++) { 417 for (size_t i = 0; i < arraysize(packets); i++) {
416 packets[i] = CreatePacketWithSsrc(ssrc); 418 packets[i] = CreatePacketWithSsrc(ssrc);
417 packets[i]->SetSequenceNumber(i); 419 packets[i]->SetSequenceNumber(rtc::dchecked_cast<uint16_t>(i));
418 } 420 }
419 421
420 InSequence sequence; 422 InSequence sequence;
421 for (const auto& packet : packets) { 423 for (const auto& packet : packets) {
422 EXPECT_CALL(sink, OnRtpPacket(SamePacketAs(*packet))).Times(1); 424 EXPECT_CALL(sink, OnRtpPacket(SamePacketAs(*packet))).Times(1);
423 } 425 }
424 426
425 for (const auto& packet : packets) { 427 for (const auto& packet : packets) {
426 EXPECT_TRUE(demuxer_.OnRtpPacket(*packet)); 428 EXPECT_TRUE(demuxer_.OnRtpPacket(*packet));
427 } 429 }
(...skipping 1087 matching lines...) Expand 10 before | Expand all | Expand 10 after
1515 TEST_F(RtpDemuxerTest, 1517 TEST_F(RtpDemuxerTest,
1516 DregisterationOfNeverRegisteredSsrcBindingObserverDisallowed) { 1518 DregisterationOfNeverRegisteredSsrcBindingObserverDisallowed) {
1517 MockSsrcBindingObserver observer; 1519 MockSsrcBindingObserver observer;
1518 EXPECT_DEATH(DeregisterSsrcBindingObserver(&observer), ""); 1520 EXPECT_DEATH(DeregisterSsrcBindingObserver(&observer), "");
1519 } 1521 }
1520 1522
1521 #endif 1523 #endif
1522 1524
1523 } // namespace 1525 } // namespace
1524 } // namespace webrtc 1526 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698