| 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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 message_loop_.Quit(); | 81 message_loop_.Quit(); |
| 82 } | 82 } |
| 83 | 83 |
| 84 void DeleteOnFailureCallback(const std::string& shared_secret) { | 84 void DeleteOnFailureCallback(const std::string& shared_secret) { |
| 85 EXPECT_TRUE(shared_secret.empty()); | 85 EXPECT_TRUE(shared_secret.empty()); |
| 86 token_validator_.reset(); | 86 token_validator_.reset(); |
| 87 message_loop_.Quit(); | 87 message_loop_.Quit(); |
| 88 } | 88 } |
| 89 | 89 |
| 90 protected: | 90 protected: |
| 91 virtual void SetUp() override { | 91 void SetUp() override { |
| 92 key_pair_ = RsaKeyPair::FromString(kTestRsaKeyPair); | 92 key_pair_ = RsaKeyPair::FromString(kTestRsaKeyPair); |
| 93 scoped_ptr<net::TestURLRequestContext> context( | 93 scoped_ptr<net::TestURLRequestContext> context( |
| 94 new SetResponseURLRequestContext()); | 94 new SetResponseURLRequestContext()); |
| 95 request_context_getter_ = new net::TestURLRequestContextGetter( | 95 request_context_getter_ = new net::TestURLRequestContextGetter( |
| 96 message_loop_.message_loop_proxy(), context.Pass()); | 96 message_loop_.message_loop_proxy(), context.Pass()); |
| 97 ThirdPartyAuthConfig config; | 97 ThirdPartyAuthConfig config; |
| 98 config.token_url = GURL(kTokenUrl); | 98 config.token_url = GURL(kTokenUrl); |
| 99 config.token_validation_url = GURL(kTokenValidationUrl); | 99 config.token_validation_url = GURL(kTokenValidationUrl); |
| 100 config.token_validation_cert_issuer = kTokenValidationCertIssuer; | 100 config.token_validation_cert_issuer = kTokenValidationCertIssuer; |
| 101 token_validator_factory_.reset(new TokenValidatorFactoryImpl( | 101 token_validator_factory_.reset(new TokenValidatorFactoryImpl( |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 180 SetResponse(net::URLRequestTestJob::test_error_headers(), std::string()); | 180 SetResponse(net::URLRequestTestJob::test_error_headers(), std::string()); |
| 181 | 181 |
| 182 token_validator_->ValidateThirdPartyToken( | 182 token_validator_->ValidateThirdPartyToken( |
| 183 kToken, base::Bind( | 183 kToken, base::Bind( |
| 184 &TokenValidatorFactoryImplTest::DeleteOnFailureCallback, | 184 &TokenValidatorFactoryImplTest::DeleteOnFailureCallback, |
| 185 base::Unretained(this))); | 185 base::Unretained(this))); |
| 186 message_loop_.Run(); | 186 message_loop_.Run(); |
| 187 } | 187 } |
| 188 | 188 |
| 189 } // namespace remoting | 189 } // namespace remoting |
| OLD | NEW |