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

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

Issue 1788943002: Revert of 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;
73 bool pairing_expected = pairing_registry_.get() != nullptr; 68 bool pairing_expected = pairing_registry_.get() != nullptr;
74 client_auth_config.fetch_secret_callback = 69 FetchSecretCallback fetch_secret_callback =
75 base::Bind(&NegotiatingAuthenticatorTest::FetchSecret, 70 base::Bind(&NegotiatingAuthenticatorTest::FetchSecret,
76 client_interactive_pin, pairing_expected); 71 client_interactive_pin,
77 client_as_negotiating_authenticator_ = 72 pairing_expected);
78 new NegotiatingClientAuthenticator(client_auth_config); 73 client_as_negotiating_authenticator_ = new NegotiatingClientAuthenticator(
74 client_id, client_paired_secret, kTestHostId, fetch_secret_callback,
75 FetchThirdPartyTokenCallback());
79 client_.reset(client_as_negotiating_authenticator_); 76 client_.reset(client_as_negotiating_authenticator_);
80 } 77 }
81 78
82 void CreatePairingRegistry(bool with_paired_client) { 79 void CreatePairingRegistry(bool with_paired_client) {
83 pairing_registry_ = new SynchronousPairingRegistry( 80 pairing_registry_ = new SynchronousPairingRegistry(
84 make_scoped_ptr(new MockPairingRegistryDelegate())); 81 make_scoped_ptr(new MockPairingRegistryDelegate()));
85 if (with_paired_client) { 82 if (with_paired_client) {
86 PairingRegistry::Pairing pairing( 83 PairingRegistry::Pairing pairing(
87 base::Time(), kTestClientName, kTestClientId, kTestPairedSecret); 84 base::Time(), kTestClientName, kTestClientId, kTestPairedSecret);
88 pairing_registry_->AddPairing(pairing); 85 pairing_registry_->AddPairing(pairing);
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 TEST_F(NegotiatingAuthenticatorTest, PairingFailedInvalidSecretAndPin) { 234 TEST_F(NegotiatingAuthenticatorTest, PairingFailedInvalidSecretAndPin) {
238 CreatePairingRegistry(true); 235 CreatePairingRegistry(true);
239 ASSERT_NO_FATAL_FAILURE(InitAuthenticators( 236 ASSERT_NO_FATAL_FAILURE(InitAuthenticators(
240 kTestClientId, kTestPairedSecretBad, kTestPinBad, kTestPin, false)); 237 kTestClientId, kTestPairedSecretBad, kTestPinBad, kTestPin, false));
241 ASSERT_NO_FATAL_FAILURE(RunAuthExchange()); 238 ASSERT_NO_FATAL_FAILURE(RunAuthExchange());
242 VerifyRejected(Authenticator::INVALID_CREDENTIALS); 239 VerifyRejected(Authenticator::INVALID_CREDENTIALS);
243 } 240 }
244 241
245 } // namespace protocol 242 } // namespace protocol
246 } // namespace remoting 243 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/client/plugin/chromoting_instance.cc ('k') | remoting/protocol/negotiating_client_authenticator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698