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

Side by Side Diff: webrtc/api/rtcstatscollector_unittest.cc

Issue 2622413005: Replace use of ASSERT in test code. (Closed)
Patch Set: Fixed another signed/unsigned comparison. Created 3 years, 11 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
« no previous file with comments | « no previous file | webrtc/api/statscollector_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2016 The WebRTC project authors. All Rights Reserved. 2 * Copyright 2016 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 772 matching lines...) Expand 10 before | Expand all | Expand 10 after
783 expected_inbound_video_codec.payload_type = 3; 783 expected_inbound_video_codec.payload_type = 3;
784 expected_inbound_video_codec.codec = "video/H264"; 784 expected_inbound_video_codec.codec = "video/H264";
785 expected_inbound_video_codec.clock_rate = 1339; 785 expected_inbound_video_codec.clock_rate = 1339;
786 786
787 RTCCodecStats expected_outbound_video_codec( 787 RTCCodecStats expected_outbound_video_codec(
788 "RTCCodec_OutboundVideo_4", report->timestamp_us()); 788 "RTCCodec_OutboundVideo_4", report->timestamp_us());
789 expected_outbound_video_codec.payload_type = 4; 789 expected_outbound_video_codec.payload_type = 4;
790 expected_outbound_video_codec.codec = "video/VP8"; 790 expected_outbound_video_codec.codec = "video/VP8";
791 expected_outbound_video_codec.clock_rate = 1340; 791 expected_outbound_video_codec.clock_rate = 1340;
792 792
793 ASSERT(report->Get(expected_inbound_audio_codec.id())); 793 ASSERT_TRUE(report->Get(expected_inbound_audio_codec.id()));
794 EXPECT_EQ(expected_inbound_audio_codec, 794 EXPECT_EQ(expected_inbound_audio_codec,
795 report->Get(expected_inbound_audio_codec.id())->cast_to< 795 report->Get(expected_inbound_audio_codec.id())->cast_to<
796 RTCCodecStats>()); 796 RTCCodecStats>());
797 797
798 ASSERT(report->Get(expected_outbound_audio_codec.id())); 798 ASSERT_TRUE(report->Get(expected_outbound_audio_codec.id()));
799 EXPECT_EQ(expected_outbound_audio_codec, 799 EXPECT_EQ(expected_outbound_audio_codec,
800 report->Get(expected_outbound_audio_codec.id())->cast_to< 800 report->Get(expected_outbound_audio_codec.id())->cast_to<
801 RTCCodecStats>()); 801 RTCCodecStats>());
802 802
803 ASSERT(report->Get(expected_inbound_video_codec.id())); 803 ASSERT_TRUE(report->Get(expected_inbound_video_codec.id()));
804 EXPECT_EQ(expected_inbound_video_codec, 804 EXPECT_EQ(expected_inbound_video_codec,
805 report->Get(expected_inbound_video_codec.id())->cast_to< 805 report->Get(expected_inbound_video_codec.id())->cast_to<
806 RTCCodecStats>()); 806 RTCCodecStats>());
807 807
808 ASSERT(report->Get(expected_outbound_video_codec.id())); 808 ASSERT_TRUE(report->Get(expected_outbound_video_codec.id()));
809 EXPECT_EQ(expected_outbound_video_codec, 809 EXPECT_EQ(expected_outbound_video_codec,
810 report->Get(expected_outbound_video_codec.id())->cast_to< 810 report->Get(expected_outbound_video_codec.id())->cast_to<
811 RTCCodecStats>()); 811 RTCCodecStats>());
812 } 812 }
813 813
814 TEST_F(RTCStatsCollectorTest, CollectRTCCertificateStatsMultiple) { 814 TEST_F(RTCStatsCollectorTest, CollectRTCCertificateStatsMultiple) {
815 std::unique_ptr<CertificateInfo> audio_local_certinfo = 815 std::unique_ptr<CertificateInfo> audio_local_certinfo =
816 CreateFakeCertificateAndInfoFromDers( 816 CreateFakeCertificateAndInfoFromDers(
817 std::vector<std::string>({ "(local) audio" })); 817 std::vector<std::string>({ "(local) audio" }));
818 audio_local_certinfo = CreateFakeCertificateAndInfoFromDers( 818 audio_local_certinfo = CreateFakeCertificateAndInfoFromDers(
(...skipping 792 matching lines...) Expand 10 before | Expand all | Expand 10 after
1611 "RTCMediaStreamTrack_remote_RemoteAudioTrackID"; 1611 "RTCMediaStreamTrack_remote_RemoteAudioTrackID";
1612 expected_audio.transport_id = "RTCTransport_TransportName_" + 1612 expected_audio.transport_id = "RTCTransport_TransportName_" +
1613 rtc::ToString<>(cricket::ICE_CANDIDATE_COMPONENT_RTP); 1613 rtc::ToString<>(cricket::ICE_CANDIDATE_COMPONENT_RTP);
1614 expected_audio.codec_id = "RTCCodec_InboundAudio_42"; 1614 expected_audio.codec_id = "RTCCodec_InboundAudio_42";
1615 expected_audio.packets_received = 2; 1615 expected_audio.packets_received = 2;
1616 expected_audio.bytes_received = 3; 1616 expected_audio.bytes_received = 3;
1617 expected_audio.packets_lost = 42; 1617 expected_audio.packets_lost = 42;
1618 expected_audio.jitter = 4.5; 1618 expected_audio.jitter = 4.5;
1619 expected_audio.fraction_lost = 5.5; 1619 expected_audio.fraction_lost = 5.5;
1620 1620
1621 ASSERT(report->Get(expected_audio.id())); 1621 ASSERT_TRUE(report->Get(expected_audio.id()));
1622 const RTCInboundRTPStreamStats& audio = report->Get( 1622 const RTCInboundRTPStreamStats& audio = report->Get(
1623 expected_audio.id())->cast_to<RTCInboundRTPStreamStats>(); 1623 expected_audio.id())->cast_to<RTCInboundRTPStreamStats>();
1624 EXPECT_EQ(audio, expected_audio); 1624 EXPECT_EQ(audio, expected_audio);
1625 1625
1626 EXPECT_TRUE(report->Get(*expected_audio.media_track_id)); 1626 EXPECT_TRUE(report->Get(*expected_audio.media_track_id));
1627 EXPECT_TRUE(report->Get(*expected_audio.transport_id)); 1627 EXPECT_TRUE(report->Get(*expected_audio.transport_id));
1628 EXPECT_TRUE(report->Get(*expected_audio.codec_id)); 1628 EXPECT_TRUE(report->Get(*expected_audio.codec_id));
1629 } 1629 }
1630 1630
1631 TEST_F(RTCStatsCollectorTest, CollectRTCInboundRTPStreamStats_Video) { 1631 TEST_F(RTCStatsCollectorTest, CollectRTCInboundRTPStreamStats_Video) {
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
1696 expected_video.codec_id = "RTCCodec_InboundVideo_42"; 1696 expected_video.codec_id = "RTCCodec_InboundVideo_42";
1697 expected_video.fir_count = 5; 1697 expected_video.fir_count = 5;
1698 expected_video.pli_count = 6; 1698 expected_video.pli_count = 6;
1699 expected_video.nack_count = 7; 1699 expected_video.nack_count = 7;
1700 expected_video.packets_received = 2; 1700 expected_video.packets_received = 2;
1701 expected_video.bytes_received = 3; 1701 expected_video.bytes_received = 3;
1702 expected_video.packets_lost = 42; 1702 expected_video.packets_lost = 42;
1703 expected_video.fraction_lost = 4.5; 1703 expected_video.fraction_lost = 4.5;
1704 expected_video.frames_decoded = 8; 1704 expected_video.frames_decoded = 8;
1705 1705
1706 ASSERT(report->Get(expected_video.id())); 1706 ASSERT_TRUE(report->Get(expected_video.id()));
1707 const RTCInboundRTPStreamStats& video = report->Get( 1707 const RTCInboundRTPStreamStats& video = report->Get(
1708 expected_video.id())->cast_to<RTCInboundRTPStreamStats>(); 1708 expected_video.id())->cast_to<RTCInboundRTPStreamStats>();
1709 EXPECT_EQ(video, expected_video); 1709 EXPECT_EQ(video, expected_video);
1710 1710
1711 EXPECT_TRUE(report->Get(*expected_video.media_track_id)); 1711 EXPECT_TRUE(report->Get(*expected_video.media_track_id));
1712 EXPECT_TRUE(report->Get(*expected_video.transport_id)); 1712 EXPECT_TRUE(report->Get(*expected_video.transport_id));
1713 EXPECT_TRUE(report->Get(*video.codec_id)); 1713 EXPECT_TRUE(report->Get(*video.codec_id));
1714 } 1714 }
1715 1715
1716 TEST_F(RTCStatsCollectorTest, CollectRTCOutboundRTPStreamStats_Audio) { 1716 TEST_F(RTCStatsCollectorTest, CollectRTCOutboundRTPStreamStats_Audio) {
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
1769 expected_audio.is_remote = false; 1769 expected_audio.is_remote = false;
1770 expected_audio.media_type = "audio"; 1770 expected_audio.media_type = "audio";
1771 expected_audio.media_track_id = "RTCMediaStreamTrack_local_LocalAudioTrackID"; 1771 expected_audio.media_track_id = "RTCMediaStreamTrack_local_LocalAudioTrackID";
1772 expected_audio.transport_id = "RTCTransport_TransportName_" + 1772 expected_audio.transport_id = "RTCTransport_TransportName_" +
1773 rtc::ToString<>(cricket::ICE_CANDIDATE_COMPONENT_RTP); 1773 rtc::ToString<>(cricket::ICE_CANDIDATE_COMPONENT_RTP);
1774 expected_audio.codec_id = "RTCCodec_OutboundAudio_42"; 1774 expected_audio.codec_id = "RTCCodec_OutboundAudio_42";
1775 expected_audio.packets_sent = 2; 1775 expected_audio.packets_sent = 2;
1776 expected_audio.bytes_sent = 3; 1776 expected_audio.bytes_sent = 3;
1777 expected_audio.round_trip_time = 4.5; 1777 expected_audio.round_trip_time = 4.5;
1778 1778
1779 ASSERT(report->Get(expected_audio.id())); 1779 ASSERT_TRUE(report->Get(expected_audio.id()));
1780 const RTCOutboundRTPStreamStats& audio = report->Get( 1780 const RTCOutboundRTPStreamStats& audio = report->Get(
1781 expected_audio.id())->cast_to<RTCOutboundRTPStreamStats>(); 1781 expected_audio.id())->cast_to<RTCOutboundRTPStreamStats>();
1782 EXPECT_EQ(audio, expected_audio); 1782 EXPECT_EQ(audio, expected_audio);
1783 1783
1784 EXPECT_TRUE(report->Get(*expected_audio.media_track_id)); 1784 EXPECT_TRUE(report->Get(*expected_audio.media_track_id));
1785 EXPECT_TRUE(report->Get(*expected_audio.transport_id)); 1785 EXPECT_TRUE(report->Get(*expected_audio.transport_id));
1786 EXPECT_TRUE(report->Get(*expected_audio.codec_id)); 1786 EXPECT_TRUE(report->Get(*expected_audio.codec_id));
1787 } 1787 }
1788 1788
1789 TEST_F(RTCStatsCollectorTest, CollectRTCOutboundRTPStreamStats_Video) { 1789 TEST_F(RTCStatsCollectorTest, CollectRTCOutboundRTPStreamStats_Video) {
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
1852 expected_video.codec_id = "RTCCodec_OutboundVideo_42"; 1852 expected_video.codec_id = "RTCCodec_OutboundVideo_42";
1853 expected_video.fir_count = 2; 1853 expected_video.fir_count = 2;
1854 expected_video.pli_count = 3; 1854 expected_video.pli_count = 3;
1855 expected_video.nack_count = 4; 1855 expected_video.nack_count = 4;
1856 expected_video.packets_sent = 5; 1856 expected_video.packets_sent = 5;
1857 expected_video.bytes_sent = 6; 1857 expected_video.bytes_sent = 6;
1858 expected_video.round_trip_time = 7.5; 1858 expected_video.round_trip_time = 7.5;
1859 expected_video.frames_encoded = 8; 1859 expected_video.frames_encoded = 8;
1860 expected_video.qp_sum = 16; 1860 expected_video.qp_sum = 16;
1861 1861
1862 ASSERT(report->Get(expected_video.id())); 1862 ASSERT_TRUE(report->Get(expected_video.id()));
1863 const RTCOutboundRTPStreamStats& video = report->Get( 1863 const RTCOutboundRTPStreamStats& video = report->Get(
1864 expected_video.id())->cast_to<RTCOutboundRTPStreamStats>(); 1864 expected_video.id())->cast_to<RTCOutboundRTPStreamStats>();
1865 EXPECT_EQ(video, expected_video); 1865 EXPECT_EQ(video, expected_video);
1866 1866
1867 EXPECT_TRUE(report->Get(*expected_video.media_track_id)); 1867 EXPECT_TRUE(report->Get(*expected_video.media_track_id));
1868 EXPECT_TRUE(report->Get(*expected_video.transport_id)); 1868 EXPECT_TRUE(report->Get(*expected_video.transport_id));
1869 EXPECT_TRUE(report->Get(*expected_video.codec_id)); 1869 EXPECT_TRUE(report->Get(*expected_video.codec_id));
1870 } 1870 }
1871 1871
1872 TEST_F(RTCStatsCollectorTest, CollectRTCOutboundRTPStreamStats_Default) { 1872 TEST_F(RTCStatsCollectorTest, CollectRTCOutboundRTPStreamStats_Default) {
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
1936 expected_audio.ssrc = "1"; 1936 expected_audio.ssrc = "1";
1937 expected_audio.is_remote = false; 1937 expected_audio.is_remote = false;
1938 expected_audio.media_type = "audio"; 1938 expected_audio.media_type = "audio";
1939 expected_audio.transport_id = "RTCTransport_TransportName_" + 1939 expected_audio.transport_id = "RTCTransport_TransportName_" +
1940 rtc::ToString<>(cricket::ICE_CANDIDATE_COMPONENT_RTP); 1940 rtc::ToString<>(cricket::ICE_CANDIDATE_COMPONENT_RTP);
1941 expected_audio.codec_id = "RTCCodec_OutboundAudio_42"; 1941 expected_audio.codec_id = "RTCCodec_OutboundAudio_42";
1942 expected_audio.packets_sent = 2; 1942 expected_audio.packets_sent = 2;
1943 expected_audio.bytes_sent = 3; 1943 expected_audio.bytes_sent = 3;
1944 // |expected_audio.round_trip_time| should be undefined. 1944 // |expected_audio.round_trip_time| should be undefined.
1945 1945
1946 ASSERT(report->Get(expected_audio.id())); 1946 ASSERT_TRUE(report->Get(expected_audio.id()));
1947 const RTCOutboundRTPStreamStats& audio = report->Get( 1947 const RTCOutboundRTPStreamStats& audio = report->Get(
1948 expected_audio.id())->cast_to<RTCOutboundRTPStreamStats>(); 1948 expected_audio.id())->cast_to<RTCOutboundRTPStreamStats>();
1949 EXPECT_EQ(audio, expected_audio); 1949 EXPECT_EQ(audio, expected_audio);
1950 1950
1951 RTCOutboundRTPStreamStats expected_video( 1951 RTCOutboundRTPStreamStats expected_video(
1952 "RTCOutboundRTPVideoStream_1", report->timestamp_us()); 1952 "RTCOutboundRTPVideoStream_1", report->timestamp_us());
1953 expected_video.ssrc = "1"; 1953 expected_video.ssrc = "1";
1954 expected_video.is_remote = false; 1954 expected_video.is_remote = false;
1955 expected_video.media_type = "video"; 1955 expected_video.media_type = "video";
1956 expected_video.transport_id = "RTCTransport_TransportName_" + 1956 expected_video.transport_id = "RTCTransport_TransportName_" +
1957 rtc::ToString<>(cricket::ICE_CANDIDATE_COMPONENT_RTP); 1957 rtc::ToString<>(cricket::ICE_CANDIDATE_COMPONENT_RTP);
1958 expected_video.codec_id = "RTCCodec_OutboundVideo_42"; 1958 expected_video.codec_id = "RTCCodec_OutboundVideo_42";
1959 expected_video.fir_count = 2; 1959 expected_video.fir_count = 2;
1960 expected_video.pli_count = 3; 1960 expected_video.pli_count = 3;
1961 expected_video.nack_count = 4; 1961 expected_video.nack_count = 4;
1962 expected_video.packets_sent = 5; 1962 expected_video.packets_sent = 5;
1963 expected_video.bytes_sent = 6; 1963 expected_video.bytes_sent = 6;
1964 expected_video.frames_encoded = 7; 1964 expected_video.frames_encoded = 7;
1965 // |expected_video.round_trip_time| should be undefined. 1965 // |expected_video.round_trip_time| should be undefined.
1966 // |expected_video.qp_sum| should be undefined. 1966 // |expected_video.qp_sum| should be undefined.
1967 1967
1968 ASSERT(report->Get(expected_video.id())); 1968 ASSERT_TRUE(report->Get(expected_video.id()));
1969 const RTCOutboundRTPStreamStats& video = report->Get( 1969 const RTCOutboundRTPStreamStats& video = report->Get(
1970 expected_video.id())->cast_to<RTCOutboundRTPStreamStats>(); 1970 expected_video.id())->cast_to<RTCOutboundRTPStreamStats>();
1971 EXPECT_EQ(video, expected_video); 1971 EXPECT_EQ(video, expected_video);
1972 } 1972 }
1973 1973
1974 TEST_F(RTCStatsCollectorTest, CollectRTCTransportStats) { 1974 TEST_F(RTCStatsCollectorTest, CollectRTCTransportStats) {
1975 std::unique_ptr<cricket::Candidate> rtp_local_candidate = CreateFakeCandidate( 1975 std::unique_ptr<cricket::Candidate> rtp_local_candidate = CreateFakeCandidate(
1976 "42.42.42.42", 42, "protocol", cricket::LOCAL_PORT_TYPE, 42); 1976 "42.42.42.42", 42, "protocol", cricket::LOCAL_PORT_TYPE, 42);
1977 std::unique_ptr<cricket::Candidate> rtp_remote_candidate = 1977 std::unique_ptr<cricket::Candidate> rtp_remote_candidate =
1978 CreateFakeCandidate("42.42.42.42", 42, "protocol", 1978 CreateFakeCandidate("42.42.42.42", 42, "protocol",
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
2142 rtc::scoped_refptr<FakeRTCStatsCollector> collector_; 2142 rtc::scoped_refptr<FakeRTCStatsCollector> collector_;
2143 }; 2143 };
2144 2144
2145 TEST_F(RTCStatsCollectorTestWithFakeCollector, ThreadUsageAndResultsMerging) { 2145 TEST_F(RTCStatsCollectorTestWithFakeCollector, ThreadUsageAndResultsMerging) {
2146 collector_->VerifyThreadUsageAndResultsMerging(); 2146 collector_->VerifyThreadUsageAndResultsMerging();
2147 } 2147 }
2148 2148
2149 } // namespace 2149 } // namespace
2150 2150
2151 } // namespace webrtc 2151 } // namespace webrtc
OLDNEW
« no previous file with comments | « no previous file | webrtc/api/statscollector_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698