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

Unified Diff: webrtc/pc/rtcstatscollector_unittest.cc

Issue 2746393003: RTCStatsCollector: Remove closed channels from opened set. (Closed)
Patch Set: Created 3 years, 9 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
« no previous file with comments | « webrtc/pc/rtcstatscollector.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/pc/rtcstatscollector_unittest.cc
diff --git a/webrtc/pc/rtcstatscollector_unittest.cc b/webrtc/pc/rtcstatscollector_unittest.cc
index ea7b34a933b21abefe20fcff52313c45f9ef56d8..8fd00c61784372198508e37c009c539469b49e5d 100644
--- a/webrtc/pc/rtcstatscollector_unittest.cc
+++ b/webrtc/pc/rtcstatscollector_unittest.cc
@@ -1463,6 +1463,39 @@ TEST_F(RTCStatsCollectorTest, CollectRTCPeerConnectionStats) {
report->Get("RTCPeerConnection")->cast_to<
RTCPeerConnectionStats>());
}
+
+ // Re-opening a data channel (or opening a new data channel that is re-using
+ // the same address in memory) should increase the opened count.
+ dummy_channel_b->SignalOpened(dummy_channel_b.get());
+
+ {
+ collector_->ClearCachedStatsReport();
+ rtc::scoped_refptr<const RTCStatsReport> report = GetStatsReport();
+ RTCPeerConnectionStats expected("RTCPeerConnection",
+ report->timestamp_us());
+ expected.data_channels_opened = 3;
+ expected.data_channels_closed = 1;
+ ASSERT_TRUE(report->Get("RTCPeerConnection"));
+ EXPECT_EQ(expected,
+ report->Get("RTCPeerConnection")->cast_to<
+ RTCPeerConnectionStats>());
+ }
+
+ dummy_channel_a->SignalClosed(dummy_channel_a.get());
+ dummy_channel_b->SignalClosed(dummy_channel_b.get());
+
+ {
+ collector_->ClearCachedStatsReport();
+ rtc::scoped_refptr<const RTCStatsReport> report = GetStatsReport();
+ RTCPeerConnectionStats expected("RTCPeerConnection",
+ report->timestamp_us());
+ expected.data_channels_opened = 3;
+ expected.data_channels_closed = 3;
+ ASSERT_TRUE(report->Get("RTCPeerConnection"));
+ EXPECT_EQ(expected,
+ report->Get("RTCPeerConnection")->cast_to<
+ RTCPeerConnectionStats>());
+ }
}
TEST_F(RTCStatsCollectorTest,
« no previous file with comments | « webrtc/pc/rtcstatscollector.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698