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

Unified Diff: pc/statscollector_unittest.cc

Issue 3007973002: Mark template class RefCountedObject as final.
Patch Set: Rebased. Created 3 years, 3 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 side-by-side diff with in-line comments
Download patch
Index: pc/statscollector_unittest.cc
diff --git a/pc/statscollector_unittest.cc b/pc/statscollector_unittest.cc
index 6a1d82702b217c3a7080c4f8fd980bc17d69ef7c..68cc235856c62696c75578a47b9b72ab07573b6e 100644
--- a/pc/statscollector_unittest.cc
+++ b/pc/statscollector_unittest.cc
@@ -572,18 +572,19 @@ class StatsCollectorTest : public testing::Test {
worker_thread_,
network_thread_)),
- session_(channel_manager_.get(), cricket::MediaConfig()) {
+ session_(channel_manager_.get(), cricket::MediaConfig()),
+ pc_(new rtc::RefCountedObject<MockPeerConnection>()) {
// By default, we ignore session GetStats calls.
EXPECT_CALL(session_, GetStats(_)).WillRepeatedly(ReturnNull());
// Add default returns for mock classes.
EXPECT_CALL(session_, video_channel()).WillRepeatedly(ReturnNull());
EXPECT_CALL(session_, voice_channel()).WillRepeatedly(ReturnNull());
- EXPECT_CALL(pc_, session()).WillRepeatedly(Return(&session_));
- EXPECT_CALL(pc_, sctp_data_channels())
+ EXPECT_CALL(*pc_, session()).WillRepeatedly(Return(&session_));
+ EXPECT_CALL(*pc_, sctp_data_channels())
.WillRepeatedly(ReturnRef(data_channels_));
- EXPECT_CALL(pc_, GetSenders()).WillRepeatedly(Return(
+ EXPECT_CALL(*pc_, GetSenders()).WillRepeatedly(Return(
std::vector<rtc::scoped_refptr<RtpSenderInterface>>()));
- EXPECT_CALL(pc_, GetReceivers()).WillRepeatedly(Return(
+ EXPECT_CALL(*pc_, GetReceivers()).WillRepeatedly(Return(
std::vector<rtc::scoped_refptr<RtpReceiverInterface>>()));
}
@@ -754,7 +755,7 @@ class StatsCollectorTest : public testing::Test {
const std::vector<std::string>& local_ders,
std::unique_ptr<rtc::FakeSSLCertificate> remote_cert,
const std::vector<std::string>& remote_ders) {
- StatsCollectorForTest stats(&pc_);
+ StatsCollectorForTest stats(pc_);
StatsReports reports; // returned values.
@@ -846,7 +847,7 @@ class StatsCollectorTest : public testing::Test {
cricket::FakeMediaEngine* media_engine_;
std::unique_ptr<cricket::ChannelManager> channel_manager_;
MockWebRtcSession session_;
- MockPeerConnection pc_;
+ rtc::scoped_refptr<MockPeerConnection> pc_;
FakeDataChannelProvider data_channel_provider_;
SessionStats session_stats_;
rtc::scoped_refptr<webrtc::MediaStream> stream_;
@@ -863,7 +864,7 @@ TEST_F(StatsCollectorTest, FilterOutNegativeDataChannelId) {
DataChannelInterface::DataState::kConnecting);
AddDataChannel(cricket::DCT_SCTP, label, id);
- StatsCollectorForTest stats(&pc_);
+ StatsCollectorForTest stats(pc_);
stats.UpdateStats(PeerConnectionInterface::kStatsOutputLevelStandard);
@@ -886,7 +887,7 @@ TEST_F(StatsCollectorTest, ExtractDataInfo) {
DataChannelInterface::DataState::kConnecting);
AddDataChannel(cricket::DCT_SCTP, label, id);
- StatsCollectorForTest stats(&pc_);
+ StatsCollectorForTest stats(pc_);
stats.UpdateStats(PeerConnectionInterface::kStatsOutputLevelStandard);
@@ -918,7 +919,7 @@ TEST_F(StatsCollectorTest, ExtractDataInfo) {
// This test verifies that 64-bit counters are passed successfully.
TEST_F(StatsCollectorTest, BytesCounterHandles64Bits) {
- StatsCollectorForTest stats(&pc_);
+ StatsCollectorForTest stats(pc_);
EXPECT_CALL(session_, GetLocalCertificate(_, _))
.WillRepeatedly(Return(false));
@@ -967,7 +968,7 @@ TEST_F(StatsCollectorTest, BytesCounterHandles64Bits) {
// Test that audio BWE information is reported via stats.
TEST_F(StatsCollectorTest, AudioBandwidthEstimationInfoIsReported) {
- StatsCollectorForTest stats(&pc_);
+ StatsCollectorForTest stats(pc_);
EXPECT_CALL(session_, GetLocalCertificate(_, _))
.WillRepeatedly(Return(false));
@@ -1034,7 +1035,7 @@ TEST_F(StatsCollectorTest, AudioBandwidthEstimationInfoIsReported) {
// Test that video BWE information is reported via stats.
TEST_F(StatsCollectorTest, VideoBandwidthEstimationInfoIsReported) {
- StatsCollectorForTest stats(&pc_);
+ StatsCollectorForTest stats(pc_);
EXPECT_CALL(session_, GetLocalCertificate(_, _))
.WillRepeatedly(Return(false));
@@ -1103,7 +1104,7 @@ TEST_F(StatsCollectorTest, VideoBandwidthEstimationInfoIsReported) {
// This test verifies that an object of type "googSession" always
// exists in the returned stats.
TEST_F(StatsCollectorTest, SessionObjectExists) {
- StatsCollectorForTest stats(&pc_);
+ StatsCollectorForTest stats(pc_);
StatsReports reports; // returned values.
stats.UpdateStats(PeerConnectionInterface::kStatsOutputLevelStandard);
@@ -1116,7 +1117,7 @@ TEST_F(StatsCollectorTest, SessionObjectExists) {
// This test verifies that only one object of type "googSession" exists
// in the returned stats.
TEST_F(StatsCollectorTest, OnlyOneSessionObjectExists) {
- StatsCollectorForTest stats(&pc_);
+ StatsCollectorForTest stats(pc_);
StatsReports reports; // returned values.
stats.UpdateStats(PeerConnectionInterface::kStatsOutputLevelStandard);
@@ -1133,7 +1134,7 @@ TEST_F(StatsCollectorTest, OnlyOneSessionObjectExists) {
// This test verifies that the empty track report exists in the returned stats
// without calling StatsCollector::UpdateStats.
TEST_F(StatsCollectorTest, TrackObjectExistsWithoutUpdateStats) {
- StatsCollectorForTest stats(&pc_);
+ StatsCollectorForTest stats(pc_);
MockVideoMediaChannel* media_channel = new MockVideoMediaChannel();
cricket::VideoChannel video_channel(
@@ -1159,7 +1160,7 @@ TEST_F(StatsCollectorTest, TrackObjectExistsWithoutUpdateStats) {
// This test verifies that the empty track report exists in the returned stats
// when StatsCollector::UpdateStats is called with ssrc stats.
TEST_F(StatsCollectorTest, TrackAndSsrcObjectExistAfterUpdateSsrcStats) {
- StatsCollectorForTest stats(&pc_);
+ StatsCollectorForTest stats(pc_);
EXPECT_CALL(session_, GetLocalCertificate(_, _))
.WillRepeatedly(Return(false));
@@ -1234,7 +1235,7 @@ TEST_F(StatsCollectorTest, TrackAndSsrcObjectExistAfterUpdateSsrcStats) {
// This test verifies that an SSRC object has the identifier of a Transport
// stats object, and that this transport stats object exists in stats.
TEST_F(StatsCollectorTest, TransportObjectLinkedFromSsrcObject) {
- StatsCollectorForTest stats(&pc_);
+ StatsCollectorForTest stats(pc_);
EXPECT_CALL(session_, GetLocalCertificate(_, _))
.WillRepeatedly(Return(false));
@@ -1300,7 +1301,7 @@ TEST_F(StatsCollectorTest, TransportObjectLinkedFromSsrcObject) {
// This test verifies that a remote stats object will not be created for
// an outgoing SSRC where remote stats are not returned.
TEST_F(StatsCollectorTest, RemoteSsrcInfoIsAbsent) {
- StatsCollectorForTest stats(&pc_);
+ StatsCollectorForTest stats(pc_);
MockVideoMediaChannel* media_channel = new MockVideoMediaChannel();
// The transport_name known by the video channel.
@@ -1322,7 +1323,7 @@ TEST_F(StatsCollectorTest, RemoteSsrcInfoIsAbsent) {
// This test verifies that a remote stats object will be created for
// an outgoing SSRC where stats are returned.
TEST_F(StatsCollectorTest, RemoteSsrcInfoIsPresent) {
- StatsCollectorForTest stats(&pc_);
+ StatsCollectorForTest stats(pc_);
EXPECT_CALL(session_, GetLocalCertificate(_, _))
.WillRepeatedly(Return(false));
@@ -1376,7 +1377,7 @@ TEST_F(StatsCollectorTest, RemoteSsrcInfoIsPresent) {
// This test verifies that the empty track report exists in the returned stats
// when StatsCollector::UpdateStats is called with ssrc stats.
TEST_F(StatsCollectorTest, ReportsFromRemoteTrack) {
- StatsCollectorForTest stats(&pc_);
+ StatsCollectorForTest stats(pc_);
EXPECT_CALL(session_, GetLocalCertificate(_, _))
.WillRepeatedly(Return(false));
@@ -1437,7 +1438,7 @@ TEST_F(StatsCollectorTest, ReportsFromRemoteTrack) {
// This test verifies the Ice Candidate report should contain the correct
// information from local/remote candidates.
TEST_F(StatsCollectorTest, IceCandidateReport) {
- StatsCollectorForTest stats(&pc_);
+ StatsCollectorForTest stats(pc_);
StatsReports reports; // returned values.
@@ -1571,7 +1572,7 @@ TEST_F(StatsCollectorTest, ChainlessCertificateReportsCreated) {
// This test verifies that the stats are generated correctly when no
// transport is present.
TEST_F(StatsCollectorTest, NoTransport) {
- StatsCollectorForTest stats(&pc_);
+ StatsCollectorForTest stats(pc_);
EXPECT_CALL(session_, GetLocalCertificate(_, _))
.WillRepeatedly(Return(false));
@@ -1630,7 +1631,7 @@ TEST_F(StatsCollectorTest, NoTransport) {
// This test verifies that the stats are generated correctly when the transport
// does not have any certificates.
TEST_F(StatsCollectorTest, NoCertificates) {
- StatsCollectorForTest stats(&pc_);
+ StatsCollectorForTest stats(pc_);
EXPECT_CALL(session_, GetLocalCertificate(_, _))
.WillRepeatedly(Return(false));
@@ -1695,7 +1696,7 @@ TEST_F(StatsCollectorTest, UnsupportedDigestIgnored) {
// This test verifies that the audio/video related stats which are -1 initially
// will be filtered out.
TEST_F(StatsCollectorTest, FilterOutNegativeInitialValues) {
- StatsCollectorForTest stats(&pc_);
+ StatsCollectorForTest stats(pc_);
EXPECT_CALL(session_, GetLocalCertificate(_, _))
.WillRepeatedly(Return(false));
@@ -1805,7 +1806,7 @@ TEST_F(StatsCollectorTest, FilterOutNegativeInitialValues) {
// This test verifies that a local stats object can get statistics via
// AudioTrackInterface::GetStats() method.
TEST_F(StatsCollectorTest, GetStatsFromLocalAudioTrack) {
- StatsCollectorForTest stats(&pc_);
+ StatsCollectorForTest stats(pc_);
EXPECT_CALL(session_, GetLocalCertificate(_, _))
.WillRepeatedly(Return(false));
@@ -1841,7 +1842,7 @@ TEST_F(StatsCollectorTest, GetStatsFromLocalAudioTrack) {
// This test verifies that audio receive streams populate stats reports
// correctly.
TEST_F(StatsCollectorTest, GetStatsFromRemoteStream) {
- StatsCollectorForTest stats(&pc_);
+ StatsCollectorForTest stats(pc_);
EXPECT_CALL(session_, GetLocalCertificate(_, _))
.WillRepeatedly(Return(false));
@@ -1871,7 +1872,7 @@ TEST_F(StatsCollectorTest, GetStatsFromRemoteStream) {
// This test verifies that a local stats object won't update its statistics
// after a RemoveLocalAudioTrack() call.
TEST_F(StatsCollectorTest, GetStatsAfterRemoveAudioStream) {
- StatsCollectorForTest stats(&pc_);
+ StatsCollectorForTest stats(pc_);
EXPECT_CALL(session_, GetLocalCertificate(_, _))
.WillRepeatedly(Return(false));
@@ -1935,7 +1936,7 @@ TEST_F(StatsCollectorTest, GetStatsAfterRemoveAudioStream) {
// This test verifies that when ongoing and incoming audio tracks are using
// the same ssrc, they populate stats reports correctly.
TEST_F(StatsCollectorTest, LocalAndRemoteTracksWithSameSsrc) {
- StatsCollectorForTest stats(&pc_);
+ StatsCollectorForTest stats(pc_);
EXPECT_CALL(session_, GetLocalCertificate(_, _))
.WillRepeatedly(Return(false));
@@ -2025,7 +2026,7 @@ TEST_F(StatsCollectorTest, LocalAndRemoteTracksWithSameSsrc) {
// TODO(xians): Figure out if it is possible to encapsulate the setup and
// avoid duplication of code in test cases.
TEST_F(StatsCollectorTest, TwoLocalTracksWithSameSsrc) {
- StatsCollectorForTest stats(&pc_);
+ StatsCollectorForTest stats(pc_);
EXPECT_CALL(session_, GetLocalCertificate(_, _))
.WillRepeatedly(Return(false));
@@ -2079,7 +2080,7 @@ TEST_F(StatsCollectorTest, TwoLocalTracksWithSameSsrc) {
// This test verifies that stats are correctly set in video send ssrc stats.
TEST_F(StatsCollectorTest, VerifyVideoSendSsrcStats) {
- StatsCollectorForTest stats(&pc_);
+ StatsCollectorForTest stats(pc_);
EXPECT_CALL(session_, GetLocalCertificate(_, _))
.WillRepeatedly(Return(false));
@@ -2127,7 +2128,7 @@ TEST_F(StatsCollectorTest, VerifyVideoSendSsrcStats) {
// This test verifies that stats are correctly set in video receive ssrc stats.
TEST_F(StatsCollectorTest, VerifyVideoReceiveSsrcStats) {
- StatsCollectorForTest stats(&pc_);
+ StatsCollectorForTest stats(pc_);
EXPECT_CALL(session_, GetLocalCertificate(_, _))
.WillRepeatedly(Return(false));

Powered by Google App Engine
This is Rietveld 408576698