Index: remoting/protocol/negotiating_authenticator_unittest.cc |
diff --git a/remoting/protocol/negotiating_authenticator_unittest.cc b/remoting/protocol/negotiating_authenticator_unittest.cc |
index 73daf833286c1d6cce8655186bdf7aceba0d8a0e..1318fc84ddb6a15c518673d32259f91ff94d6361 100644 |
--- a/remoting/protocol/negotiating_authenticator_unittest.cc |
+++ b/remoting/protocol/negotiating_authenticator_unittest.cc |
@@ -59,7 +59,7 @@ class NegotiatingAuthenticatorTest : public AuthenticatorTestBase { |
AuthenticationMethod::NONE)); |
} |
client_ = NegotiatingAuthenticator::CreateForClient( |
- kTestHostId, client_secret, methods); |
+ kTestHostId, client_secret, NULL, methods); |
} |
void VerifyRejected(Authenticator::RejectionReason reason) { |
@@ -69,6 +69,28 @@ class NegotiatingAuthenticatorTest : public AuthenticatorTestBase { |
(host_->rejection_reason() == reason))); |
} |
+ void VerifyAccepted() { |
+ ASSERT_NO_FATAL_FAILURE(RunAuthExchange()); |
+ |
+ ASSERT_EQ(Authenticator::ACCEPTED, host_->state()); |
+ ASSERT_EQ(Authenticator::ACCEPTED, client_->state()); |
+ |
+ client_auth_ = client_->CreateChannelAuthenticator(); |
+ host_auth_ = host_->CreateChannelAuthenticator(); |
+ RunChannelAuth(false); |
+ |
+ EXPECT_TRUE(client_socket_.get() != NULL); |
+ EXPECT_TRUE(host_socket_.get() != NULL); |
+ |
+ StreamConnectionTester tester(host_socket_.get(), client_socket_.get(), |
+ kMessageSize, kMessages); |
+ |
+ tester.Start(); |
+ message_loop_.Run(); |
+ tester.CheckResults(); |
+ } |
+ |
+ private: |
DISALLOW_COPY_AND_ASSIGN(NegotiatingAuthenticatorTest); |
}; |
@@ -76,48 +98,14 @@ TEST_F(NegotiatingAuthenticatorTest, SuccessfulAuthHmac) { |
ASSERT_NO_FATAL_FAILURE(InitAuthenticators( |
kTestSharedSecret, kTestSharedSecret, |
AuthenticationMethod::HMAC_SHA256, false)); |
- ASSERT_NO_FATAL_FAILURE(RunAuthExchange()); |
- |
- ASSERT_EQ(Authenticator::ACCEPTED, host_->state()); |
- ASSERT_EQ(Authenticator::ACCEPTED, client_->state()); |
- |
- client_auth_ = client_->CreateChannelAuthenticator(); |
- host_auth_ = host_->CreateChannelAuthenticator(); |
- RunChannelAuth(false); |
- |
- EXPECT_TRUE(client_socket_.get() != NULL); |
- EXPECT_TRUE(host_socket_.get() != NULL); |
- |
- StreamConnectionTester tester(host_socket_.get(), client_socket_.get(), |
- kMessageSize, kMessages); |
- |
- tester.Start(); |
- message_loop_.Run(); |
- tester.CheckResults(); |
+ VerifyAccepted(); |
} |
TEST_F(NegotiatingAuthenticatorTest, SuccessfulAuthPlain) { |
ASSERT_NO_FATAL_FAILURE(InitAuthenticators( |
kTestSharedSecret, kTestSharedSecret, |
AuthenticationMethod::NONE, false)); |
- ASSERT_NO_FATAL_FAILURE(RunAuthExchange()); |
- |
- ASSERT_EQ(Authenticator::ACCEPTED, host_->state()); |
- ASSERT_EQ(Authenticator::ACCEPTED, client_->state()); |
- |
- client_auth_ = client_->CreateChannelAuthenticator(); |
- host_auth_ = host_->CreateChannelAuthenticator(); |
- RunChannelAuth(false); |
- |
- EXPECT_TRUE(client_socket_.get() != NULL); |
- EXPECT_TRUE(host_socket_.get() != NULL); |
- |
- StreamConnectionTester tester(host_socket_.get(), client_socket_.get(), |
- kMessageSize, kMessages); |
- |
- tester.Start(); |
- message_loop_.Run(); |
- tester.CheckResults(); |
+ VerifyAccepted(); |
} |
TEST_F(NegotiatingAuthenticatorTest, InvalidSecretHmac) { |