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 "base/macros.h" | 6 #include "base/macros.h" |
7 #include "base/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.h" |
8 #include "base/run_loop.h" | 8 #include "base/run_loop.h" |
9 #include "net/base/net_errors.h" | 9 #include "net/base/net_errors.h" |
10 #include "remoting/base/rsa_key_pair.h" | 10 #include "remoting/base/rsa_key_pair.h" |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 | 90 |
91 void DisableMethodOnHost(NegotiatingAuthenticatorBase::Method method) { | 91 void DisableMethodOnHost(NegotiatingAuthenticatorBase::Method method) { |
92 auto* methods = &(host_as_negotiating_authenticator_->methods_); | 92 auto* methods = &(host_as_negotiating_authenticator_->methods_); |
93 auto iter = std::find(methods->begin(), methods->end(), method); | 93 auto iter = std::find(methods->begin(), methods->end(), method); |
94 ASSERT_TRUE(iter != methods->end()); | 94 ASSERT_TRUE(iter != methods->end()); |
95 methods->erase(iter); | 95 methods->erase(iter); |
96 } | 96 } |
97 | 97 |
98 void CreatePairingRegistry(bool with_paired_client) { | 98 void CreatePairingRegistry(bool with_paired_client) { |
99 pairing_registry_ = new SynchronousPairingRegistry( | 99 pairing_registry_ = new SynchronousPairingRegistry( |
100 base::WrapUnique(new MockPairingRegistryDelegate())); | 100 base::MakeUnique<MockPairingRegistryDelegate>()); |
101 if (with_paired_client) { | 101 if (with_paired_client) { |
102 PairingRegistry::Pairing pairing( | 102 PairingRegistry::Pairing pairing( |
103 base::Time(), kTestClientName, kTestClientId, kTestPairedSecret); | 103 base::Time(), kTestClientName, kTestClientId, kTestPairedSecret); |
104 pairing_registry_->AddPairing(pairing); | 104 pairing_registry_->AddPairing(pairing); |
105 } | 105 } |
106 } | 106 } |
107 | 107 |
108 static void FetchSecret( | 108 static void FetchSecret( |
109 const std::string& client_secret, | 109 const std::string& client_secret, |
110 bool pairing_supported, | 110 bool pairing_supported, |
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
310 TEST_P(NegotiatingPairingAuthenticatorTest, PairingFailedInvalidSecretAndPin) { | 310 TEST_P(NegotiatingPairingAuthenticatorTest, PairingFailedInvalidSecretAndPin) { |
311 CreatePairingRegistry(true); | 311 CreatePairingRegistry(true); |
312 ASSERT_NO_FATAL_FAILURE(InitAuthenticators( | 312 ASSERT_NO_FATAL_FAILURE(InitAuthenticators( |
313 kTestClientId, kTestPairedSecretBad, kTestPinBad, kTestPin)); | 313 kTestClientId, kTestPairedSecretBad, kTestPinBad, kTestPin)); |
314 ASSERT_NO_FATAL_FAILURE(RunAuthExchange()); | 314 ASSERT_NO_FATAL_FAILURE(RunAuthExchange()); |
315 VerifyRejected(Authenticator::INVALID_CREDENTIALS); | 315 VerifyRejected(Authenticator::INVALID_CREDENTIALS); |
316 } | 316 } |
317 | 317 |
318 } // namespace protocol | 318 } // namespace protocol |
319 } // namespace remoting | 319 } // namespace remoting |
OLD | NEW |