diff options
author | dcheng@chromium.org <dcheng@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-02-05 00:41:37 +0000 |
---|---|---|
committer | dcheng@chromium.org <dcheng@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-02-05 00:41:37 +0000 |
commit | de0c4f55561ced93620c8c4bdc85f9fc73f1ac1e (patch) | |
tree | e0405b3e2d716c899f689cd3eb296b6f61355972 /remoting | |
parent | 84ecb145e08dbdaf118683d03fdde3f31e3f933d (diff) | |
download | chromium_src-de0c4f55561ced93620c8c4bdc85f9fc73f1ac1e.zip chromium_src-de0c4f55561ced93620c8c4bdc85f9fc73f1ac1e.tar.gz chromium_src-de0c4f55561ced93620c8c4bdc85f9fc73f1ac1e.tar.bz2 |
Remove redundant reset() calls in AuthenticatorTestBase::RunChannelAuth.
The code already transfers ownership of these pointers in the callbacks,
so there's no need to do it again.
BUG=162971
Review URL: https://chromiumcodereview.appspot.com/12178005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@180581 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'remoting')
-rw-r--r-- | remoting/protocol/authenticator_test_base.cc | 22 | ||||
-rw-r--r-- | remoting/protocol/authenticator_test_base.h | 2 |
2 files changed, 8 insertions, 16 deletions
diff --git a/remoting/protocol/authenticator_test_base.cc b/remoting/protocol/authenticator_test_base.cc index 9607113..03da2c7 100644 --- a/remoting/protocol/authenticator_test_base.cc +++ b/remoting/protocol/authenticator_test_base.cc @@ -107,23 +107,18 @@ void AuthenticatorTestBase::RunChannelAuth(bool expected_fail) { base::Bind(&AuthenticatorTestBase::OnHostConnected, base::Unretained(this))); - net::StreamSocket* client_socket = NULL; - net::StreamSocket* host_socket = NULL; - // Expect two callbacks to be called - the client callback and the host // callback. int callback_counter = 2; - EXPECT_CALL(client_callback_, OnDone(net::OK, _)) - .WillOnce(DoAll(SaveArg<1>(&client_socket), - QuitThreadOnCounter(&callback_counter))); + EXPECT_CALL(client_callback_, OnDone(net::OK)) + .WillOnce(QuitThreadOnCounter(&callback_counter)); if (expected_fail) { - EXPECT_CALL(host_callback_, OnDone(net::ERR_FAILED, NULL)) + EXPECT_CALL(host_callback_, OnDone(net::ERR_FAILED)) .WillOnce(QuitThreadOnCounter(&callback_counter)); } else { - EXPECT_CALL(host_callback_, OnDone(net::OK, _)) - .WillOnce(DoAll(SaveArg<1>(&host_socket), - QuitThreadOnCounter(&callback_counter))); + EXPECT_CALL(host_callback_, OnDone(net::OK)) + .WillOnce(QuitThreadOnCounter(&callback_counter)); } // Ensure that .Run() does not run unbounded if the callbacks are never @@ -137,9 +132,6 @@ void AuthenticatorTestBase::RunChannelAuth(bool expected_fail) { testing::Mock::VerifyAndClearExpectations(&client_callback_); testing::Mock::VerifyAndClearExpectations(&host_callback_); - client_socket_.reset(client_socket); - host_socket_.reset(host_socket); - if (!expected_fail) { ASSERT_TRUE(client_socket_.get() != NULL); ASSERT_TRUE(host_socket_.get() != NULL); @@ -149,14 +141,14 @@ void AuthenticatorTestBase::RunChannelAuth(bool expected_fail) { void AuthenticatorTestBase::OnHostConnected( net::Error error, scoped_ptr<net::StreamSocket> socket) { - host_callback_.OnDone(error, socket.get()); + host_callback_.OnDone(error); host_socket_ = socket.Pass(); } void AuthenticatorTestBase::OnClientConnected( net::Error error, scoped_ptr<net::StreamSocket> socket) { - client_callback_.OnDone(error, socket.get()); + client_callback_.OnDone(error); client_socket_ = socket.Pass(); } diff --git a/remoting/protocol/authenticator_test_base.h b/remoting/protocol/authenticator_test_base.h index cf2a73e..fc4856c 100644 --- a/remoting/protocol/authenticator_test_base.h +++ b/remoting/protocol/authenticator_test_base.h @@ -37,7 +37,7 @@ class AuthenticatorTestBase : public testing::Test { public: MockChannelDoneCallback(); ~MockChannelDoneCallback(); - MOCK_METHOD2(OnDone, void(net::Error error, net::StreamSocket* socket)); + MOCK_METHOD1(OnDone, void(net::Error error)); }; virtual void SetUp() OVERRIDE; |