| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "base/bind.h" | 5 #include "base/bind.h" |
| 6 #include "net/base/net_errors.h" | 6 #include "net/base/net_errors.h" |
| 7 #include "remoting/base/rsa_key_pair.h" | 7 #include "remoting/base/rsa_key_pair.h" |
| 8 #include "remoting/protocol/authenticator_test_base.h" | 8 #include "remoting/protocol/authenticator_test_base.h" |
| 9 #include "remoting/protocol/channel_authenticator.h" | 9 #include "remoting/protocol/channel_authenticator.h" |
| 10 #include "remoting/protocol/connection_tester.h" | 10 #include "remoting/protocol/connection_tester.h" |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 pairing_expected); | 78 pairing_expected); |
| 79 client_as_negotiating_authenticator_ = new NegotiatingClientAuthenticator( | 79 client_as_negotiating_authenticator_ = new NegotiatingClientAuthenticator( |
| 80 client_id, client_paired_secret, | 80 client_id, client_paired_secret, |
| 81 kTestHostId, fetch_secret_callback, | 81 kTestHostId, fetch_secret_callback, |
| 82 scoped_ptr<ThirdPartyClientAuthenticator::TokenFetcher>(), methods); | 82 scoped_ptr<ThirdPartyClientAuthenticator::TokenFetcher>(), methods); |
| 83 client_.reset(client_as_negotiating_authenticator_); | 83 client_.reset(client_as_negotiating_authenticator_); |
| 84 } | 84 } |
| 85 | 85 |
| 86 void CreatePairingRegistry(bool with_paired_client) { | 86 void CreatePairingRegistry(bool with_paired_client) { |
| 87 mock_delegate_ = new MockPairingRegistryDelegate; | 87 mock_delegate_ = new MockPairingRegistryDelegate; |
| 88 pairing_registry_ = new PairingRegistry( |
| 89 scoped_ptr<PairingRegistry::Delegate>(mock_delegate_)); |
| 88 if (with_paired_client) { | 90 if (with_paired_client) { |
| 89 PairingRegistry::Pairing pairing( | 91 PairingRegistry::Pairing pairing( |
| 90 base::Time(), kTestClientName, kTestClientId, kTestPairedSecret); | 92 base::Time(), kTestClientName, kTestClientId, kTestPairedSecret); |
| 91 mock_delegate_->AddPairing(pairing, | 93 pairing_registry_->AddPairing(pairing); |
| 92 PairingRegistry::AddPairingCallback()); | 94 mock_delegate_->RunCallback(); |
| 93 } | 95 } |
| 94 pairing_registry_ = new PairingRegistry( | |
| 95 scoped_ptr<PairingRegistry::Delegate>(mock_delegate_)); | |
| 96 } | 96 } |
| 97 | 97 |
| 98 static void FetchSecret( | 98 static void FetchSecret( |
| 99 const std::string& client_secret, | 99 const std::string& client_secret, |
| 100 bool pairing_supported, | 100 bool pairing_supported, |
| 101 bool pairing_expected, | 101 bool pairing_expected, |
| 102 const protocol::SecretFetchedCallback& secret_fetched_callback) { | 102 const protocol::SecretFetchedCallback& secret_fetched_callback) { |
| 103 secret_fetched_callback.Run(client_secret); | 103 secret_fetched_callback.Run(client_secret); |
| 104 ASSERT_EQ(pairing_supported, pairing_expected); | 104 ASSERT_EQ(pairing_supported, pairing_expected); |
| 105 } | 105 } |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 256 ASSERT_NO_FATAL_FAILURE(InitAuthenticators( | 256 ASSERT_NO_FATAL_FAILURE(InitAuthenticators( |
| 257 kTestClientId, kTestPairedSecretBad, kTestPinBad, kTestPin, | 257 kTestClientId, kTestPairedSecretBad, kTestPinBad, kTestPin, |
| 258 AuthenticationMethod::HMAC_SHA256, false)); | 258 AuthenticationMethod::HMAC_SHA256, false)); |
| 259 ASSERT_NO_FATAL_FAILURE(RunAuthExchange()); | 259 ASSERT_NO_FATAL_FAILURE(RunAuthExchange()); |
| 260 mock_delegate_->RunCallback(); | 260 mock_delegate_->RunCallback(); |
| 261 VerifyRejected(Authenticator::INVALID_CREDENTIALS); | 261 VerifyRejected(Authenticator::INVALID_CREDENTIALS); |
| 262 } | 262 } |
| 263 | 263 |
| 264 } // namespace protocol | 264 } // namespace protocol |
| 265 } // namespace remoting | 265 } // namespace remoting |
| OLD | NEW |