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

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

Issue 2430603003: Implement qpSum stat for video send ssrc stats. (Closed)
Patch Set: Change qp_sum to rtc::Optional<uint64_t>. Created 4 years, 1 month 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 2014 The WebRTC project authors. All Rights Reserved. 2 * Copyright 2014 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 1903 matching lines...) Expand 10 before | Expand all | Expand 10 after
1914 StatsReports reports; // returned values. 1914 StatsReports reports; // returned values.
1915 cricket::VideoSenderInfo video_sender_info; 1915 cricket::VideoSenderInfo video_sender_info;
1916 cricket::VideoMediaInfo stats_read; 1916 cricket::VideoMediaInfo stats_read;
1917 1917
1918 AddOutgoingVideoTrackStats(); 1918 AddOutgoingVideoTrackStats();
1919 stats.AddStream(stream_); 1919 stats.AddStream(stream_);
1920 1920
1921 // Construct a stats value to read. 1921 // Construct a stats value to read.
1922 video_sender_info.add_ssrc(1234); 1922 video_sender_info.add_ssrc(1234);
1923 video_sender_info.frames_encoded = 10; 1923 video_sender_info.frames_encoded = 10;
1924 video_sender_info.qp_sum = rtc::Optional<uint64_t>(11);
1924 stats_read.senders.push_back(video_sender_info); 1925 stats_read.senders.push_back(video_sender_info);
1925 1926
1926 EXPECT_CALL(session_, video_channel()).WillRepeatedly(Return(&video_channel)); 1927 EXPECT_CALL(session_, video_channel()).WillRepeatedly(Return(&video_channel));
1927 EXPECT_CALL(session_, voice_channel()).WillRepeatedly(ReturnNull()); 1928 EXPECT_CALL(session_, voice_channel()).WillRepeatedly(ReturnNull());
1928 EXPECT_CALL(*media_channel, GetStats(_)) 1929 EXPECT_CALL(*media_channel, GetStats(_))
1929 .WillOnce(DoAll(SetArgPointee<0>(stats_read), Return(true))); 1930 .WillOnce(DoAll(SetArgPointee<0>(stats_read), Return(true)));
1930 stats.UpdateStats(PeerConnectionInterface::kStatsOutputLevelStandard); 1931 stats.UpdateStats(PeerConnectionInterface::kStatsOutputLevelStandard);
1931 stats.GetStats(NULL, &reports); 1932 stats.GetStats(NULL, &reports);
1932 EXPECT_EQ(rtc::ToString(video_sender_info.frames_encoded), 1933 EXPECT_EQ(rtc::ToString(video_sender_info.frames_encoded),
1933 ExtractSsrcStatsValue(reports, 1934 ExtractSsrcStatsValue(reports,
1934 StatsReport::kStatsValueNameFramesEncoded)); 1935 StatsReport::kStatsValueNameFramesEncoded));
1936 EXPECT_EQ(rtc::ToString(*video_sender_info.qp_sum),
1937 ExtractSsrcStatsValue(reports, StatsReport::kStatsValueNameQpSum));
1935 } 1938 }
1936 1939
1937 // This test verifies that stats are correctly set in video receive ssrc stats. 1940 // This test verifies that stats are correctly set in video receive ssrc stats.
1938 TEST_F(StatsCollectorTest, VerifyVideoReceiveSsrcStats) { 1941 TEST_F(StatsCollectorTest, VerifyVideoReceiveSsrcStats) {
1939 StatsCollectorForTest stats(&pc_); 1942 StatsCollectorForTest stats(&pc_);
1940 1943
1941 EXPECT_CALL(session_, GetLocalCertificate(_, _)) 1944 EXPECT_CALL(session_, GetLocalCertificate(_, _))
1942 .WillRepeatedly(Return(false)); 1945 .WillRepeatedly(Return(false));
1943 EXPECT_CALL(session_, GetRemoteSSLCertificate_ReturnsRawPointer(_)) 1946 EXPECT_CALL(session_, GetRemoteSSLCertificate_ReturnsRawPointer(_))
1944 .WillRepeatedly(Return(nullptr)); 1947 .WillRepeatedly(Return(nullptr));
(...skipping 25 matching lines...) Expand all
1970 EXPECT_CALL(*media_channel, GetStats(_)) 1973 EXPECT_CALL(*media_channel, GetStats(_))
1971 .WillOnce(DoAll(SetArgPointee<0>(stats_read), Return(true))); 1974 .WillOnce(DoAll(SetArgPointee<0>(stats_read), Return(true)));
1972 stats.UpdateStats(PeerConnectionInterface::kStatsOutputLevelStandard); 1975 stats.UpdateStats(PeerConnectionInterface::kStatsOutputLevelStandard);
1973 stats.GetStats(NULL, &reports); 1976 stats.GetStats(NULL, &reports);
1974 EXPECT_EQ(rtc::ToString(video_receiver_info.frames_decoded), 1977 EXPECT_EQ(rtc::ToString(video_receiver_info.frames_decoded),
1975 ExtractSsrcStatsValue(reports, 1978 ExtractSsrcStatsValue(reports,
1976 StatsReport::kStatsValueNameFramesDecoded)); 1979 StatsReport::kStatsValueNameFramesDecoded));
1977 } 1980 }
1978 1981
1979 } // namespace webrtc 1982 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698