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 "net/base/net_errors.h" | 11 #include "net/base/net_errors.h" |
11 #include "remoting/base/rsa_key_pair.h" | 12 #include "remoting/base/rsa_key_pair.h" |
12 #include "remoting/protocol/authenticator_test_base.h" | 13 #include "remoting/protocol/authenticator_test_base.h" |
13 #include "remoting/protocol/channel_authenticator.h" | 14 #include "remoting/protocol/channel_authenticator.h" |
14 #include "remoting/protocol/connection_tester.h" | 15 #include "remoting/protocol/connection_tester.h" |
15 #include "remoting/protocol/fake_authenticator.h" | 16 #include "remoting/protocol/fake_authenticator.h" |
16 #include "remoting/protocol/third_party_authenticator_base.h" | 17 #include "remoting/protocol/third_party_authenticator_base.h" |
17 #include "remoting/protocol/third_party_client_authenticator.h" | 18 #include "remoting/protocol/third_party_client_authenticator.h" |
18 #include "remoting/protocol/third_party_host_authenticator.h" | 19 #include "remoting/protocol/third_party_host_authenticator.h" |
19 #include "remoting/protocol/token_validator.h" | 20 #include "remoting/protocol/token_validator.h" |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 | 98 |
98 public: | 99 public: |
99 ThirdPartyAuthenticatorTest() {} | 100 ThirdPartyAuthenticatorTest() {} |
100 ~ThirdPartyAuthenticatorTest() override {} | 101 ~ThirdPartyAuthenticatorTest() override {} |
101 | 102 |
102 protected: | 103 protected: |
103 void InitAuthenticators() { | 104 void InitAuthenticators() { |
104 token_validator_ = new FakeTokenValidator(); | 105 token_validator_ = new FakeTokenValidator(); |
105 host_.reset(new ThirdPartyHostAuthenticator( | 106 host_.reset(new ThirdPartyHostAuthenticator( |
106 base::Bind(&V2Authenticator::CreateForHost, host_cert_, key_pair_), | 107 base::Bind(&V2Authenticator::CreateForHost, host_cert_, key_pair_), |
107 make_scoped_ptr(token_validator_))); | 108 base::WrapUnique(token_validator_))); |
108 client_.reset(new ThirdPartyClientAuthenticator( | 109 client_.reset(new ThirdPartyClientAuthenticator( |
109 base::Bind(&V2Authenticator::CreateForClient), | 110 base::Bind(&V2Authenticator::CreateForClient), |
110 base::Bind(&FakeTokenFetcher::FetchThirdPartyToken, | 111 base::Bind(&FakeTokenFetcher::FetchThirdPartyToken, |
111 base::Unretained(&token_fetcher_)))); | 112 base::Unretained(&token_fetcher_)))); |
112 } | 113 } |
113 | 114 |
114 FakeTokenFetcher token_fetcher_; | 115 FakeTokenFetcher token_fetcher_; |
115 FakeTokenValidator* token_validator_; | 116 FakeTokenValidator* token_validator_; |
116 | 117 |
117 private: | 118 private: |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 ASSERT_EQ(Authenticator::PROCESSING_MESSAGE, host_->state()); | 203 ASSERT_EQ(Authenticator::PROCESSING_MESSAGE, host_->state()); |
203 ASSERT_NO_FATAL_FAILURE( | 204 ASSERT_NO_FATAL_FAILURE( |
204 token_validator_->OnTokenValidated(kSharedSecret)); | 205 token_validator_->OnTokenValidated(kSharedSecret)); |
205 | 206 |
206 // The end result is that the host rejected the fake authentication. | 207 // The end result is that the host rejected the fake authentication. |
207 ASSERT_EQ(Authenticator::REJECTED, client_->state()); | 208 ASSERT_EQ(Authenticator::REJECTED, client_->state()); |
208 } | 209 } |
209 | 210 |
210 } // namespace protocol | 211 } // namespace protocol |
211 } // namespace remoting | 212 } // namespace remoting |
OLD | NEW |