| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include <utility> | 5 #include <utility> |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/callback_helpers.h" | 8 #include "base/callback_helpers.h" |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
| 11 #include "base/run_loop.h" |
| 11 #include "net/base/net_errors.h" | 12 #include "net/base/net_errors.h" |
| 12 #include "remoting/base/rsa_key_pair.h" | 13 #include "remoting/base/rsa_key_pair.h" |
| 13 #include "remoting/protocol/authenticator_test_base.h" | 14 #include "remoting/protocol/authenticator_test_base.h" |
| 14 #include "remoting/protocol/channel_authenticator.h" | 15 #include "remoting/protocol/channel_authenticator.h" |
| 15 #include "remoting/protocol/connection_tester.h" | 16 #include "remoting/protocol/connection_tester.h" |
| 16 #include "remoting/protocol/fake_authenticator.h" | 17 #include "remoting/protocol/fake_authenticator.h" |
| 17 #include "remoting/protocol/third_party_authenticator_base.h" | 18 #include "remoting/protocol/third_party_authenticator_base.h" |
| 18 #include "remoting/protocol/third_party_client_authenticator.h" | 19 #include "remoting/protocol/third_party_client_authenticator.h" |
| 19 #include "remoting/protocol/third_party_host_authenticator.h" | 20 #include "remoting/protocol/third_party_host_authenticator.h" |
| 20 #include "remoting/protocol/token_validator.h" | 21 #include "remoting/protocol/token_validator.h" |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 | 134 |
| 134 // An authenticated channel can be created after the authentication. | 135 // An authenticated channel can be created after the authentication. |
| 135 client_auth_ = client_->CreateChannelAuthenticator(); | 136 client_auth_ = client_->CreateChannelAuthenticator(); |
| 136 host_auth_ = host_->CreateChannelAuthenticator(); | 137 host_auth_ = host_->CreateChannelAuthenticator(); |
| 137 RunChannelAuth(false); | 138 RunChannelAuth(false); |
| 138 | 139 |
| 139 StreamConnectionTester tester(host_socket_.get(), client_socket_.get(), | 140 StreamConnectionTester tester(host_socket_.get(), client_socket_.get(), |
| 140 kMessageSize, kMessages); | 141 kMessageSize, kMessages); |
| 141 | 142 |
| 142 tester.Start(); | 143 tester.Start(); |
| 143 message_loop_.Run(); | 144 base::RunLoop().Run(); |
| 144 tester.CheckResults(); | 145 tester.CheckResults(); |
| 145 } | 146 } |
| 146 | 147 |
| 147 TEST_F(ThirdPartyAuthenticatorTest, ClientNoSecret) { | 148 TEST_F(ThirdPartyAuthenticatorTest, ClientNoSecret) { |
| 148 ASSERT_NO_FATAL_FAILURE(InitAuthenticators()); | 149 ASSERT_NO_FATAL_FAILURE(InitAuthenticators()); |
| 149 ASSERT_NO_FATAL_FAILURE(RunHostInitiatedAuthExchange()); | 150 ASSERT_NO_FATAL_FAILURE(RunHostInitiatedAuthExchange()); |
| 150 ASSERT_EQ(Authenticator::PROCESSING_MESSAGE, client_->state()); | 151 ASSERT_EQ(Authenticator::PROCESSING_MESSAGE, client_->state()); |
| 151 ASSERT_NO_FATAL_FAILURE(token_fetcher_.OnTokenFetched(kToken, std::string())); | 152 ASSERT_NO_FATAL_FAILURE(token_fetcher_.OnTokenFetched(kToken, std::string())); |
| 152 | 153 |
| 153 // The end result is that the client rejected the connection, since it | 154 // The end result is that the client rejected the connection, since it |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 203 ASSERT_EQ(Authenticator::PROCESSING_MESSAGE, host_->state()); | 204 ASSERT_EQ(Authenticator::PROCESSING_MESSAGE, host_->state()); |
| 204 ASSERT_NO_FATAL_FAILURE( | 205 ASSERT_NO_FATAL_FAILURE( |
| 205 token_validator_->OnTokenValidated(kSharedSecret)); | 206 token_validator_->OnTokenValidated(kSharedSecret)); |
| 206 | 207 |
| 207 // The end result is that the host rejected the fake authentication. | 208 // The end result is that the host rejected the fake authentication. |
| 208 ASSERT_EQ(Authenticator::REJECTED, client_->state()); | 209 ASSERT_EQ(Authenticator::REJECTED, client_->state()); |
| 209 } | 210 } |
| 210 | 211 |
| 211 } // namespace protocol | 212 } // namespace protocol |
| 212 } // namespace remoting | 213 } // namespace remoting |
| OLD | NEW |