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

Unified Diff: talk/app/webrtc/webrtcsession_unittest.cc

Issue 1590333004: Making WebRtcSession fire a destroyed signal. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 11 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
« talk/app/webrtc/dtmfsender.cc ('K') | « talk/app/webrtc/webrtcsession.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: talk/app/webrtc/webrtcsession_unittest.cc
diff --git a/talk/app/webrtc/webrtcsession_unittest.cc b/talk/app/webrtc/webrtcsession_unittest.cc
index e81b8b5b545cb57ad7c84f2e56d38fddd2f19ae5..0319b21b0695cadf6cb02d35a0c9eb006766ef99 100644
--- a/talk/app/webrtc/webrtcsession_unittest.cc
+++ b/talk/app/webrtc/webrtcsession_unittest.cc
@@ -410,6 +410,8 @@ class WebRtcSessionTest
allocator_.get(), &observer_));
session_->SignalDataChannelOpenMessage.connect(
this, &WebRtcSessionTest::OnDataChannelOpenMessage);
+ session_->GetOnDestroyedSignal()->connect(
+ this, &WebRtcSessionTest::OnSessionDestroyed);
EXPECT_EQ(PeerConnectionInterface::kIceConnectionNew,
observer_.ice_connection_state_);
@@ -428,6 +430,8 @@ class WebRtcSessionTest
last_data_channel_config_ = config;
}
+ void OnSessionDestroyed() { session_destroyed_ = true; }
+
void Init() {
PeerConnectionInterface::RTCConfiguration configuration;
Init(nullptr, configuration);
@@ -1473,6 +1477,7 @@ class WebRtcSessionTest
// Last values received from data channel creation signal.
std::string last_data_channel_label_;
InternalDataChannelInit last_data_channel_config_;
+ bool session_destroyed_;
joachim 2016/01/21 13:10:54 Just driving by, this should IMHO be initialized t
Taylor Brandstetter 2016/01/21 18:21:07 Good catch, thanks!
};
TEST_P(WebRtcSessionTest, TestInitializeWithDtls) {
@@ -4313,6 +4318,14 @@ TEST_F(WebRtcSessionTest, TestPacketOptionsAndOnPacketSent) {
TestPacketOptions();
}
+// Make sure the signal from "GetOnDestroyedSignal()" fires when the session
+// is destroyed.
+TEST_F(WebRtcSessionTest, TestOnDestroyedSignal) {
+ Init();
+ session_.reset();
+ EXPECT_TRUE(session_destroyed_);
+}
+
// TODO(bemasc): Add a TestIceStatesBundle with BUNDLE enabled. That test
// currently fails because upon disconnection and reconnection OnIceComplete is
// called more than once without returning to IceGatheringGathering.
« talk/app/webrtc/dtmfsender.cc ('K') | « talk/app/webrtc/webrtcsession.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698