Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(473)

Unified Diff: remoting/protocol/negotiating_authenticator_unittest.cc

Issue 12518027: Protocol / client plugin changes to support interactively asking for a PIN (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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) {

Powered by Google App Engine
This is Rietveld 408576698