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

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

Issue 2423823003: Implement framesDecoded stat in video receive ssrc stats. (Closed)
Patch Set: More unittests. Created 4 years, 2 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 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 1916 matching lines...) Expand 10 before | Expand all | Expand 10 after
1927 EXPECT_CALL(session_, voice_channel()).WillRepeatedly(ReturnNull()); 1927 EXPECT_CALL(session_, voice_channel()).WillRepeatedly(ReturnNull());
1928 EXPECT_CALL(*media_channel, GetStats(_)) 1928 EXPECT_CALL(*media_channel, GetStats(_))
1929 .WillOnce(DoAll(SetArgPointee<0>(stats_read), Return(true))); 1929 .WillOnce(DoAll(SetArgPointee<0>(stats_read), Return(true)));
1930 stats.UpdateStats(PeerConnectionInterface::kStatsOutputLevelStandard); 1930 stats.UpdateStats(PeerConnectionInterface::kStatsOutputLevelStandard);
1931 stats.GetStats(NULL, &reports); 1931 stats.GetStats(NULL, &reports);
1932 EXPECT_EQ(rtc::ToString(video_sender_info.frames_encoded), 1932 EXPECT_EQ(rtc::ToString(video_sender_info.frames_encoded),
1933 ExtractSsrcStatsValue(reports, 1933 ExtractSsrcStatsValue(reports,
1934 StatsReport::kStatsValueNameFramesEncoded)); 1934 StatsReport::kStatsValueNameFramesEncoded));
1935 } 1935 }
1936 1936
1937 // This test verifies that stats are correctly set in video receive ssrc stats.
1938 TEST_F(StatsCollectorTest, VerifyVideoReceiveSsrcStats) {
1939 StatsCollectorForTest stats(&pc_);
1940
1941 EXPECT_CALL(session_, GetLocalCertificate(_, _))
1942 .WillRepeatedly(Return(false));
1943 EXPECT_CALL(session_, GetRemoteSSLCertificate_ReturnsRawPointer(_))
1944 .WillRepeatedly(Return(nullptr));
1945
1946 const char kVideoChannelName[] = "video";
1947
1948 InitSessionStats(kVideoChannelName);
1949 EXPECT_CALL(session_, GetTransportStats(_))
1950 .WillRepeatedly(DoAll(SetArgPointee<0>(session_stats_), Return(true)));
1951
1952 MockVideoMediaChannel* media_channel = new MockVideoMediaChannel();
1953 cricket::VideoChannel video_channel(worker_thread_, network_thread_,
1954 media_channel, nullptr, kVideoChannelName,
1955 false);
1956 StatsReports reports; // returned values.
1957 cricket::VideoReceiverInfo video_receiver_info;
1958 cricket::VideoMediaInfo stats_read;
1959
1960 AddIncomingVideoTrackStats();
1961 stats.AddStream(stream_);
1962
1963 // Construct a stats value to read.
1964 video_receiver_info.add_ssrc(1234);
1965 video_receiver_info.frames_decoded = 10;
1966 stats_read.receivers.push_back(video_receiver_info);
1967
1968 EXPECT_CALL(session_, video_channel()).WillRepeatedly(Return(&video_channel));
1969 EXPECT_CALL(session_, voice_channel()).WillRepeatedly(ReturnNull());
1970 EXPECT_CALL(*media_channel, GetStats(_))
1971 .WillOnce(DoAll(SetArgPointee<0>(stats_read), Return(true)));
1972 stats.UpdateStats(PeerConnectionInterface::kStatsOutputLevelStandard);
1973 stats.GetStats(NULL, &reports);
1974 EXPECT_EQ(rtc::ToString(video_receiver_info.frames_decoded),
1975 ExtractSsrcStatsValue(reports,
1976 StatsReport::kStatsValueNameFramesDecoded));
1977 }
1978
1937 } // namespace webrtc 1979 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698