| 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 // A set of unit tests for TokenValidatorFactoryImpl | 5 // A set of unit tests for TokenValidatorFactoryImpl |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/json/json_writer.h" | 9 #include "base/json/json_writer.h" |
| 10 #include "base/values.h" | 10 #include "base/values.h" |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 SetResponseURLRequestContext* context = | 125 SetResponseURLRequestContext* context = |
| 126 static_cast<SetResponseURLRequestContext*>( | 126 static_cast<SetResponseURLRequestContext*>( |
| 127 request_context_getter_->GetURLRequestContext()); | 127 request_context_getter_->GetURLRequestContext()); |
| 128 context->SetResponse(headers, response); | 128 context->SetResponse(headers, response); |
| 129 } | 129 } |
| 130 | 130 |
| 131 base::MessageLoop message_loop_; | 131 base::MessageLoop message_loop_; |
| 132 scoped_refptr<RsaKeyPair> key_pair_; | 132 scoped_refptr<RsaKeyPair> key_pair_; |
| 133 scoped_refptr<net::URLRequestContextGetter> request_context_getter_; | 133 scoped_refptr<net::URLRequestContextGetter> request_context_getter_; |
| 134 scoped_ptr<TokenValidatorFactoryImpl> token_validator_factory_; | 134 scoped_ptr<TokenValidatorFactoryImpl> token_validator_factory_; |
| 135 scoped_ptr<protocol::ThirdPartyHostAuthenticator::TokenValidator> | 135 scoped_ptr<protocol::TokenValidator> token_validator_; |
| 136 token_validator_; | |
| 137 }; | 136 }; |
| 138 | 137 |
| 139 TEST_F(TokenValidatorFactoryImplTest, Success) { | 138 TEST_F(TokenValidatorFactoryImplTest, Success) { |
| 140 token_validator_ = token_validator_factory_->CreateTokenValidator( | 139 token_validator_ = token_validator_factory_->CreateTokenValidator( |
| 141 kLocalJid, kRemoteJid); | 140 kLocalJid, kRemoteJid); |
| 142 | 141 |
| 143 SetResponse(net::URLRequestTestJob::test_headers(), | 142 SetResponse(net::URLRequestTestJob::test_headers(), |
| 144 CreateResponse(token_validator_->token_scope())); | 143 CreateResponse(token_validator_->token_scope())); |
| 145 | 144 |
| 146 token_validator_->ValidateThirdPartyToken( | 145 token_validator_->ValidateThirdPartyToken( |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 181 SetResponse(net::URLRequestTestJob::test_error_headers(), std::string()); | 180 SetResponse(net::URLRequestTestJob::test_error_headers(), std::string()); |
| 182 | 181 |
| 183 token_validator_->ValidateThirdPartyToken( | 182 token_validator_->ValidateThirdPartyToken( |
| 184 kToken, base::Bind( | 183 kToken, base::Bind( |
| 185 &TokenValidatorFactoryImplTest::DeleteOnFailureCallback, | 184 &TokenValidatorFactoryImplTest::DeleteOnFailureCallback, |
| 186 base::Unretained(this))); | 185 base::Unretained(this))); |
| 187 message_loop_.Run(); | 186 message_loop_.Run(); |
| 188 } | 187 } |
| 189 | 188 |
| 190 } // namespace remoting | 189 } // namespace remoting |
| OLD | NEW |