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 22 matching lines...) Expand all Loading... |
33 // Bad scope: no nonce element. | 33 // Bad scope: no nonce element. |
34 const char kBadScope[] = | 34 const char kBadScope[] = |
35 "client:user@example.com/local host:user@example.com/remote"; | 35 "client:user@example.com/local host:user@example.com/remote"; |
36 | 36 |
37 class FakeProtocolHandler : public net::URLRequestJobFactory::ProtocolHandler { | 37 class FakeProtocolHandler : public net::URLRequestJobFactory::ProtocolHandler { |
38 public: | 38 public: |
39 FakeProtocolHandler(const std::string& headers, const std::string& response) | 39 FakeProtocolHandler(const std::string& headers, const std::string& response) |
40 : headers_(headers), | 40 : headers_(headers), |
41 response_(response) { | 41 response_(response) { |
42 } | 42 } |
43 virtual net::URLRequestJob* MaybeCreateJob( | 43 net::URLRequestJob* MaybeCreateJob( |
44 net::URLRequest* request, net::NetworkDelegate* network_delegate) const | 44 net::URLRequest* request, |
45 override { | 45 net::NetworkDelegate* network_delegate) const override { |
46 return new net::URLRequestTestJob( | 46 return new net::URLRequestTestJob( |
47 request, network_delegate, headers_, response_, true); | 47 request, network_delegate, headers_, response_, true); |
48 } | 48 } |
49 | 49 |
50 private: | 50 private: |
51 std::string headers_; | 51 std::string headers_; |
52 std::string response_; | 52 std::string response_; |
53 }; | 53 }; |
54 | 54 |
55 class SetResponseURLRequestContext: public net::TestURLRequestContext { | 55 class SetResponseURLRequestContext: public net::TestURLRequestContext { |
(...skipping 124 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 |