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 "base/bind.h" | 5 #include "base/bind.h" |
6 #include "base/callback_helpers.h" | 6 #include "base/callback_helpers.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/authenticator_test_base.h" | 9 #include "remoting/protocol/authenticator_test_base.h" |
10 #include "remoting/protocol/channel_authenticator.h" | 10 #include "remoting/protocol/channel_authenticator.h" |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 | 93 |
94 public: | 94 public: |
95 ThirdPartyAuthenticatorTest() {} | 95 ThirdPartyAuthenticatorTest() {} |
96 ~ThirdPartyAuthenticatorTest() override {} | 96 ~ThirdPartyAuthenticatorTest() override {} |
97 | 97 |
98 protected: | 98 protected: |
99 void InitAuthenticators() { | 99 void InitAuthenticators() { |
100 scoped_ptr<TokenValidator> token_validator(new FakeTokenValidator()); | 100 scoped_ptr<TokenValidator> token_validator(new FakeTokenValidator()); |
101 token_validator_ = static_cast<FakeTokenValidator*>(token_validator.get()); | 101 token_validator_ = static_cast<FakeTokenValidator*>(token_validator.get()); |
102 host_.reset(new ThirdPartyHostAuthenticator( | 102 host_.reset(new ThirdPartyHostAuthenticator( |
103 host_cert_, key_pair_, token_validator.Pass())); | 103 host_cert_, key_pair_, std::move(token_validator))); |
104 scoped_ptr<ThirdPartyClientAuthenticator::TokenFetcher> | 104 scoped_ptr<ThirdPartyClientAuthenticator::TokenFetcher> |
105 token_fetcher(new FakeTokenFetcher()); | 105 token_fetcher(new FakeTokenFetcher()); |
106 token_fetcher_ = static_cast<FakeTokenFetcher*>(token_fetcher.get()); | 106 token_fetcher_ = static_cast<FakeTokenFetcher*>(token_fetcher.get()); |
107 client_.reset(new ThirdPartyClientAuthenticator(token_fetcher.Pass())); | 107 client_.reset(new ThirdPartyClientAuthenticator(std::move(token_fetcher))); |
108 } | 108 } |
109 | 109 |
110 FakeTokenFetcher* token_fetcher_; | 110 FakeTokenFetcher* token_fetcher_; |
111 FakeTokenValidator* token_validator_; | 111 FakeTokenValidator* token_validator_; |
112 | 112 |
113 private: | 113 private: |
114 DISALLOW_COPY_AND_ASSIGN(ThirdPartyAuthenticatorTest); | 114 DISALLOW_COPY_AND_ASSIGN(ThirdPartyAuthenticatorTest); |
115 }; | 115 }; |
116 | 116 |
117 TEST_F(ThirdPartyAuthenticatorTest, SuccessfulAuth) { | 117 TEST_F(ThirdPartyAuthenticatorTest, SuccessfulAuth) { |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 ASSERT_EQ(Authenticator::PROCESSING_MESSAGE, host_->state()); | 202 ASSERT_EQ(Authenticator::PROCESSING_MESSAGE, host_->state()); |
203 ASSERT_NO_FATAL_FAILURE( | 203 ASSERT_NO_FATAL_FAILURE( |
204 token_validator_->OnTokenValidated(kSharedSecret)); | 204 token_validator_->OnTokenValidated(kSharedSecret)); |
205 | 205 |
206 // The end result is that the host rejected the fake authentication. | 206 // The end result is that the host rejected the fake authentication. |
207 ASSERT_EQ(Authenticator::REJECTED, client_->state()); | 207 ASSERT_EQ(Authenticator::REJECTED, client_->state()); |
208 } | 208 } |
209 | 209 |
210 } // namespace protocol | 210 } // namespace protocol |
211 } // namespace remoting | 211 } // namespace remoting |
OLD | NEW |