OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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/files/file_path.h" | 5 #include "base/files/file_path.h" |
| 6 #include "net/base/ip_endpoint.h" |
6 #include "net/base/net_errors.h" | 7 #include "net/base/net_errors.h" |
7 #include "net/base/test_completion_callback.h" | 8 #include "net/base/test_completion_callback.h" |
8 #include "net/base/test_data_directory.h" | 9 #include "net/base/test_data_directory.h" |
9 #include "net/cert/cert_status_flags.h" | 10 #include "net/cert/cert_status_flags.h" |
10 #include "net/cert/cert_verify_result.h" | 11 #include "net/cert/cert_verify_result.h" |
11 #include "net/cert/x509_certificate.h" | 12 #include "net/cert/x509_certificate.h" |
12 #include "net/quic/crypto/proof_source.h" | 13 #include "net/quic/crypto/proof_source.h" |
13 #include "net/quic/crypto/proof_verifier.h" | 14 #include "net/quic/crypto/proof_verifier.h" |
14 #include "net/quic/test_tools/crypto_test_utils.h" | 15 #include "net/quic/test_tools/crypto_test_utils.h" |
15 #include "net/test/cert_test_util.h" | 16 #include "net/test/cert_test_util.h" |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 TEST(ProofTest, DISABLED_Verify) { | 112 TEST(ProofTest, DISABLED_Verify) { |
112 scoped_ptr<ProofSource> source(CryptoTestUtils::ProofSourceForTesting()); | 113 scoped_ptr<ProofSource> source(CryptoTestUtils::ProofSourceForTesting()); |
113 scoped_ptr<ProofVerifier> verifier( | 114 scoped_ptr<ProofVerifier> verifier( |
114 CryptoTestUtils::ProofVerifierForTesting()); | 115 CryptoTestUtils::ProofVerifierForTesting()); |
115 | 116 |
116 const string server_config = "server config bytes"; | 117 const string server_config = "server config bytes"; |
117 const string hostname = "test.example.com"; | 118 const string hostname = "test.example.com"; |
118 const vector<string>* certs; | 119 const vector<string>* certs; |
119 const vector<string>* first_certs; | 120 const vector<string>* first_certs; |
120 string error_details, signature, first_signature; | 121 string error_details, signature, first_signature; |
| 122 IPEndPoint server_ip; |
121 | 123 |
122 ASSERT_TRUE(source->GetProof(hostname, server_config, false /* no ECDSA */, | 124 ASSERT_TRUE(source->GetProof(server_ip, hostname, server_config, |
123 &first_certs, &first_signature)); | 125 false /* no ECDSA */, &first_certs, |
124 ASSERT_TRUE(source->GetProof(hostname, server_config, false /* no ECDSA */, | 126 &first_signature)); |
125 &certs, &signature)); | 127 ASSERT_TRUE(source->GetProof(server_ip, hostname, server_config, |
| 128 false /* no ECDSA */, &certs, &signature)); |
126 | 129 |
127 // Check that the proof source is caching correctly: | 130 // Check that the proof source is caching correctly: |
128 ASSERT_EQ(first_certs, certs); | 131 ASSERT_EQ(first_certs, certs); |
129 ASSERT_EQ(signature, first_signature); | 132 ASSERT_EQ(signature, first_signature); |
130 | 133 |
131 RunVerification( | 134 RunVerification( |
132 verifier.get(), hostname, server_config, *certs, signature, true); | 135 verifier.get(), hostname, server_config, *certs, signature, true); |
133 | 136 |
134 RunVerification( | 137 RunVerification( |
135 verifier.get(), "foo.com", server_config, *certs, signature, false); | 138 verifier.get(), "foo.com", server_config, *certs, signature, false); |
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
362 wrong_certs.push_back(certs[i]); | 365 wrong_certs.push_back(certs[i]); |
363 } | 366 } |
364 RunVerification( | 367 RunVerification( |
365 verifier.get(), hostname, server_config, wrong_certs, signature, | 368 verifier.get(), hostname, server_config, wrong_certs, signature, |
366 false); | 369 false); |
367 } | 370 } |
368 } | 371 } |
369 | 372 |
370 } // namespace test | 373 } // namespace test |
371 } // namespace net | 374 } // namespace net |
OLD | NEW |