Index: remoting/host/client_session_unittest.cc |
diff --git a/remoting/host/client_session_unittest.cc b/remoting/host/client_session_unittest.cc |
index c7568b1753a1ff820f370d4b0aa6f9ea51f148cb..3e7190ed05fef9fe538a93ad1b5e7ab13fdfcbcb 100644 |
--- a/remoting/host/client_session_unittest.cc |
+++ b/remoting/host/client_session_unittest.cc |
@@ -5,7 +5,6 @@ |
#include "base/bind.h" |
#include "remoting/host/client_session.h" |
#include "remoting/host/host_mock_objects.h" |
-#include "remoting/host/user_authenticator_fake.h" |
#include "remoting/protocol/protocol_mock_objects.h" |
#include "testing/gtest/include/gtest/gtest.h" |
@@ -13,10 +12,6 @@ namespace remoting { |
namespace { |
-UserAuthenticator* MakeUserAuthenticator() { |
- return new UserAuthenticatorFake(); |
-} |
- |
// A task that does nothing. |
class DummyTask : public Task { |
public: |
@@ -32,27 +27,31 @@ using protocol::MockInputStub; |
using testing::_; |
using testing::InSequence; |
+using testing::Return; |
class ClientSessionTest : public testing::Test { |
public: |
- ClientSessionTest() { |
- } |
+ ClientSessionTest() {} |
virtual void SetUp() { |
connection_ = new MockConnectionToClient(&message_loop_, |
&connection_event_handler_, |
&host_stub_, |
&input_stub_); |
- client_session_ = new ClientSession(&session_event_handler_, |
- base::Bind(MakeUserAuthenticator), |
- connection_, |
- &input_stub_); |
+ user_authenticator_ = new MockUserAuthenticator(); |
+ client_session_ = new ClientSession( |
+ &session_event_handler_, |
+ base::Bind(&ClientSessionTest::user_authenticator, |
+ base::Unretained(this)), |
+ connection_, |
+ &input_stub_); |
credentials_.set_type(protocol::PASSWORD); |
credentials_.set_username("user"); |
credentials_.set_credential("password"); |
} |
- virtual void TearDown() { |
+ UserAuthenticator* user_authenticator() { |
+ return user_authenticator_.get(); |
} |
protected: |
@@ -61,6 +60,7 @@ class ClientSessionTest : public testing::Test { |
MockHostStub host_stub_; |
MockInputStub input_stub_; |
MockClientSessionEventHandler session_event_handler_; |
+ scoped_refptr<MockUserAuthenticator> user_authenticator_; |
scoped_refptr<MockConnectionToClient> connection_; |
scoped_refptr<ClientSession> client_session_; |
protocol::LocalLoginCredentials credentials_; |
@@ -96,6 +96,8 @@ TEST_F(ClientSessionTest, InputStubFilter) { |
credentials_.set_credential("password"); |
InSequence s; |
+ EXPECT_CALL(*user_authenticator_, Authenticate(_, _)) |
+ .WillOnce(Return(true)); |
EXPECT_CALL(session_event_handler_, LocalLoginSucceeded(_)); |
EXPECT_CALL(input_stub_, InjectKeyEvent(&key_event2, _)); |
EXPECT_CALL(input_stub_, InjectMouseEvent(&mouse_event2, _)); |