diff options
author | sergeyu <sergeyu@chromium.org> | 2014-09-23 13:44:53 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-09-23 20:45:26 +0000 |
commit | 8668e3f025c0acc5c77dfb54755835f5f91a5270 (patch) | |
tree | 8740dbc64fe2f4bdda829ce5e068185316419a43 /remoting | |
parent | 7fc5f5fef792ce336e77eabefb0bad9fc4f1be46 (diff) | |
download | chromium_src-8668e3f025c0acc5c77dfb54755835f5f91a5270.zip chromium_src-8668e3f025c0acc5c77dfb54755835f5f91a5270.tar.gz chromium_src-8668e3f025c0acc5c77dfb54755835f5f91a5270.tar.bz2 |
Fix side-effect in DCHECK that breaks another DCHECK in JingleSession.
DCHECK(!channels_[name]) adds NULL channel with |name| into the
map, which was breaking DCHECK in JingleSession destructor. Replaced
with another DCHECK that doesn't have side-effects. Added unittest
to catch this problem.
Also removed no-op line from ~JingleSession().
Review URL: https://codereview.chromium.org/594743002
Cr-Commit-Position: refs/heads/master@{#296224}
Diffstat (limited to 'remoting')
-rw-r--r-- | remoting/protocol/jingle_session.cc | 3 | ||||
-rw-r--r-- | remoting/protocol/jingle_session_unittest.cc | 14 |
2 files changed, 15 insertions, 2 deletions
diff --git a/remoting/protocol/jingle_session.cc b/remoting/protocol/jingle_session.cc index 33938c6..1778d39 100644 --- a/remoting/protocol/jingle_session.cc +++ b/remoting/protocol/jingle_session.cc @@ -85,7 +85,6 @@ JingleSession::~JingleSession() { STLDeleteContainerPointers(transport_info_requests_.begin(), transport_info_requests_.end()); - channel_multiplexer_.reset(); DCHECK(channels_.empty()); session_manager_->SessionDestroyed(this); @@ -274,7 +273,7 @@ void JingleSession::CancelChannelCreation(const std::string& name) { if (it != channels_.end()) { DCHECK(!it->second->is_connected()); delete it->second; - DCHECK(!channels_[name]); + DCHECK(channels_.find(name) == channels_.end()); } } diff --git a/remoting/protocol/jingle_session_unittest.cc b/remoting/protocol/jingle_session_unittest.cc index d7ce228..2788137 100644 --- a/remoting/protocol/jingle_session_unittest.cc +++ b/remoting/protocol/jingle_session_unittest.cc @@ -521,5 +521,19 @@ TEST_F(JingleSessionTest, TestFailedChannelAuth) { EXPECT_TRUE(!host_socket_.get()); } +TEST_F(JingleSessionTest, TestCancelChannelCreation) { + CreateSessionManagers(1, FakeAuthenticator::REJECT_CHANNEL); + ASSERT_NO_FATAL_FAILURE( + InitiateConnection(1, FakeAuthenticator::ACCEPT, false)); + + client_session_->GetTransportChannelFactory()->CreateChannel( + kChannelName, base::Bind(&JingleSessionTest::OnClientChannelCreated, + base::Unretained(this))); + client_session_->GetTransportChannelFactory()->CancelChannelCreation( + kChannelName); + + EXPECT_TRUE(!client_socket_.get()); +} + } // namespace protocol } // namespace remoting |