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

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

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

Powered by Google App Engine
This is Rietveld 408576698