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 "net/base/net_errors.h" | 6 #include "net/base/net_errors.h" |
7 #include "remoting/base/rsa_key_pair.h" | 7 #include "remoting/base/rsa_key_pair.h" |
8 #include "remoting/protocol/authenticator_test_base.h" | 8 #include "remoting/protocol/authenticator_test_base.h" |
9 #include "remoting/protocol/channel_authenticator.h" | 9 #include "remoting/protocol/channel_authenticator.h" |
10 #include "remoting/protocol/connection_tester.h" | 10 #include "remoting/protocol/connection_tester.h" |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 const std::string& token_scope() const override { return token_scope_; } | 89 const std::string& token_scope() const override { return token_scope_; } |
90 | 90 |
91 private: | 91 private: |
92 GURL token_url_; | 92 GURL token_url_; |
93 std::string token_scope_; | 93 std::string token_scope_; |
94 base::Callback<void(const std::string& shared_secret)> on_token_validated_; | 94 base::Callback<void(const std::string& shared_secret)> on_token_validated_; |
95 }; | 95 }; |
96 | 96 |
97 public: | 97 public: |
98 ThirdPartyAuthenticatorTest() {} | 98 ThirdPartyAuthenticatorTest() {} |
99 virtual ~ThirdPartyAuthenticatorTest() {} | 99 ~ThirdPartyAuthenticatorTest() override {} |
100 | 100 |
101 protected: | 101 protected: |
102 void InitAuthenticators() { | 102 void InitAuthenticators() { |
103 scoped_ptr<TokenValidator> token_validator(new FakeTokenValidator()); | 103 scoped_ptr<TokenValidator> token_validator(new FakeTokenValidator()); |
104 token_validator_ = static_cast<FakeTokenValidator*>(token_validator.get()); | 104 token_validator_ = static_cast<FakeTokenValidator*>(token_validator.get()); |
105 host_.reset(new ThirdPartyHostAuthenticator( | 105 host_.reset(new ThirdPartyHostAuthenticator( |
106 host_cert_, key_pair_, token_validator.Pass())); | 106 host_cert_, key_pair_, token_validator.Pass())); |
107 scoped_ptr<ThirdPartyClientAuthenticator::TokenFetcher> | 107 scoped_ptr<ThirdPartyClientAuthenticator::TokenFetcher> |
108 token_fetcher(new FakeTokenFetcher()); | 108 token_fetcher(new FakeTokenFetcher()); |
109 token_fetcher_ = static_cast<FakeTokenFetcher*>(token_fetcher.get()); | 109 token_fetcher_ = static_cast<FakeTokenFetcher*>(token_fetcher.get()); |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
205 ASSERT_EQ(Authenticator::PROCESSING_MESSAGE, host_->state()); | 205 ASSERT_EQ(Authenticator::PROCESSING_MESSAGE, host_->state()); |
206 ASSERT_NO_FATAL_FAILURE( | 206 ASSERT_NO_FATAL_FAILURE( |
207 token_validator_->OnTokenValidated(kSharedSecret)); | 207 token_validator_->OnTokenValidated(kSharedSecret)); |
208 | 208 |
209 // The end result is that the host rejected the fake authentication. | 209 // The end result is that the host rejected the fake authentication. |
210 ASSERT_EQ(Authenticator::REJECTED, client_->state()); | 210 ASSERT_EQ(Authenticator::REJECTED, client_->state()); |
211 } | 211 } |
212 | 212 |
213 } // namespace protocol | 213 } // namespace protocol |
214 } // namespace remoting | 214 } // namespace remoting |
OLD | NEW |