diff options
author | simonmorris@chromium.org <simonmorris@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-07-02 18:55:29 +0000 |
---|---|---|
committer | simonmorris@chromium.org <simonmorris@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-07-02 18:55:29 +0000 |
commit | 07e76bb101ed558f564edd99998911833274bfd4 (patch) | |
tree | 44912a64ac07a2a51a9b69f9861f3acff0eca2de /remoting | |
parent | 536b9f42263208c82ca1ed851abf3845d08a81dd (diff) | |
download | chromium_src-07e76bb101ed558f564edd99998911833274bfd4.zip chromium_src-07e76bb101ed558f564edd99998911833274bfd4.tar.gz chromium_src-07e76bb101ed558f564edd99998911833274bfd4.tar.bz2 |
[Chromoting] Fix memory leaks in ChromotingHost unit tests.
BUG=135274
Review URL: https://chromiumcodereview.appspot.com/10698065
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@145170 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'remoting')
-rw-r--r-- | remoting/host/chromoting_host_unittest.cc | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/remoting/host/chromoting_host_unittest.cc b/remoting/host/chromoting_host_unittest.cc index f97cb49..edc5ac5 100644 --- a/remoting/host/chromoting_host_unittest.cc +++ b/remoting/host/chromoting_host_unittest.cc @@ -188,6 +188,11 @@ class ChromotingHostTest : public testing::Test { .Times(AnyNumber()); EXPECT_CALL(*connection2_, session()) .Times(AnyNumber()); + + empty_candidate_config_ = + protocol::CandidateSessionConfig::CreateEmpty(); + default_candidate_config_ = + protocol::CandidateSessionConfig::CreateDefault(); } // Helper method to pretend a client is connected to ChromotingHost. @@ -313,6 +318,8 @@ class ChromotingHostTest : public testing::Test { SessionConfig session2_unowned_config_; std::string session2_unowned_jid_; protocol::Session::StateChangeCallback session_state_change_callback_; + scoped_ptr<protocol::CandidateSessionConfig> empty_candidate_config_; + scoped_ptr<protocol::CandidateSessionConfig> default_candidate_config_; // Owned by |host_|. MockDisconnectWindow* disconnect_window_; @@ -574,7 +581,7 @@ TEST_F(ChromotingHostTest, IncomingSessionIncompatible) { EXPECT_CALL(*disconnect_window_, Hide()); EXPECT_CALL(*continue_window_, Hide()); EXPECT_CALL(*session_unowned_, candidate_config()).WillOnce(Return( - protocol::CandidateSessionConfig::CreateEmpty().release())); + empty_candidate_config_.get())); EXPECT_CALL(host_status_observer_, OnShutdown()); host_->set_protocol_config( @@ -594,7 +601,7 @@ TEST_F(ChromotingHostTest, IncomingSessionAccepted) { EXPECT_CALL(*disconnect_window_, Hide()); EXPECT_CALL(*continue_window_, Hide()); EXPECT_CALL(*session_unowned_, candidate_config()).WillOnce(Return( - protocol::CandidateSessionConfig::CreateDefault().release())); + default_candidate_config_.get())); EXPECT_CALL(*session_unowned_, set_config(_)); EXPECT_CALL(*session_unowned_, Close()).WillOnce(InvokeWithoutArgs( this, &ChromotingHostTest::NotifyConnectionClosed)); @@ -618,7 +625,7 @@ TEST_F(ChromotingHostTest, IncomingSessionOverload) { EXPECT_CALL(*disconnect_window_, Hide()); EXPECT_CALL(*continue_window_, Hide()); EXPECT_CALL(*session_unowned_, candidate_config()).WillOnce(Return( - protocol::CandidateSessionConfig::CreateDefault().release())); + default_candidate_config_.get())); EXPECT_CALL(*session_unowned_, set_config(_)); EXPECT_CALL(*session_unowned_, Close()).WillOnce(InvokeWithoutArgs( this, &ChromotingHostTest::NotifyConnectionClosed)); |