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

Side by Side Diff: remoting/protocol/negotiating_authenticator_unittest.cc

Issue 1778023002: Move NegotiatingClientAuthentication creation to ChromotingClient. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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 unified diff | Download patch
OLDNEW
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 "base/macros.h" 6 #include "base/macros.h"
7 #include "net/base/net_errors.h" 7 #include "net/base/net_errors.h"
8 #include "remoting/base/rsa_key_pair.h" 8 #include "remoting/base/rsa_key_pair.h"
9 #include "remoting/protocol/auth_util.h" 9 #include "remoting/protocol/auth_util.h"
10 #include "remoting/protocol/authenticator_test_base.h" 10 #include "remoting/protocol/authenticator_test_base.h"
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 if (it2me) { 58 if (it2me) {
59 host_ = NegotiatingHostAuthenticator::CreateForIt2Me( 59 host_ = NegotiatingHostAuthenticator::CreateForIt2Me(
60 host_cert_, key_pair_, host_secret); 60 host_cert_, key_pair_, host_secret);
61 } else { 61 } else {
62 std::string host_secret_hash = 62 std::string host_secret_hash =
63 GetSharedSecretHash(kTestHostId, host_secret); 63 GetSharedSecretHash(kTestHostId, host_secret);
64 host_ = NegotiatingHostAuthenticator::CreateWithPin( 64 host_ = NegotiatingHostAuthenticator::CreateWithPin(
65 host_cert_, key_pair_, host_secret_hash, pairing_registry_); 65 host_cert_, key_pair_, host_secret_hash, pairing_registry_);
66 } 66 }
67 67
68
69 protocol::ClientAuthenticationConfig client_auth_config;
70 client_auth_config.host_id = kTestHostId;
71 client_auth_config.pairing_client_id = client_id;
72 client_auth_config.pairing_secret= client_paired_secret;
68 bool pairing_expected = pairing_registry_.get() != nullptr; 73 bool pairing_expected = pairing_registry_.get() != nullptr;
69 FetchSecretCallback fetch_secret_callback = 74 client_auth_config.fetch_secret_callback =
70 base::Bind(&NegotiatingAuthenticatorTest::FetchSecret, 75 base::Bind(&NegotiatingAuthenticatorTest::FetchSecret,
71 client_interactive_pin, 76 client_interactive_pin, pairing_expected);
72 pairing_expected); 77 client_as_negotiating_authenticator_ =
73 client_as_negotiating_authenticator_ = new NegotiatingClientAuthenticator( 78 new NegotiatingClientAuthenticator(client_auth_config);
74 client_id, client_paired_secret, kTestHostId, fetch_secret_callback,
75 FetchThirdPartyTokenCallback());
76 client_.reset(client_as_negotiating_authenticator_); 79 client_.reset(client_as_negotiating_authenticator_);
77 } 80 }
78 81
79 void CreatePairingRegistry(bool with_paired_client) { 82 void CreatePairingRegistry(bool with_paired_client) {
80 pairing_registry_ = new SynchronousPairingRegistry( 83 pairing_registry_ = new SynchronousPairingRegistry(
81 make_scoped_ptr(new MockPairingRegistryDelegate())); 84 make_scoped_ptr(new MockPairingRegistryDelegate()));
82 if (with_paired_client) { 85 if (with_paired_client) {
83 PairingRegistry::Pairing pairing( 86 PairingRegistry::Pairing pairing(
84 base::Time(), kTestClientName, kTestClientId, kTestPairedSecret); 87 base::Time(), kTestClientName, kTestClientId, kTestPairedSecret);
85 pairing_registry_->AddPairing(pairing); 88 pairing_registry_->AddPairing(pairing);
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 TEST_F(NegotiatingAuthenticatorTest, PairingFailedInvalidSecretAndPin) { 237 TEST_F(NegotiatingAuthenticatorTest, PairingFailedInvalidSecretAndPin) {
235 CreatePairingRegistry(true); 238 CreatePairingRegistry(true);
236 ASSERT_NO_FATAL_FAILURE(InitAuthenticators( 239 ASSERT_NO_FATAL_FAILURE(InitAuthenticators(
237 kTestClientId, kTestPairedSecretBad, kTestPinBad, kTestPin, false)); 240 kTestClientId, kTestPairedSecretBad, kTestPinBad, kTestPin, false));
238 ASSERT_NO_FATAL_FAILURE(RunAuthExchange()); 241 ASSERT_NO_FATAL_FAILURE(RunAuthExchange());
239 VerifyRejected(Authenticator::INVALID_CREDENTIALS); 242 VerifyRejected(Authenticator::INVALID_CREDENTIALS);
240 } 243 }
241 244
242 } // namespace protocol 245 } // namespace protocol
243 } // namespace remoting 246 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/protocol/negotiating_authenticator_base.h ('k') | remoting/protocol/negotiating_client_authenticator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698