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/ip_endpoint.h" |
7 #include "net/base/net_errors.h" | 7 #include "net/base/net_errors.h" |
8 #include "net/base/test_completion_callback.h" | 8 #include "net/base/test_completion_callback.h" |
9 #include "net/base/test_data_directory.h" | 9 #include "net/base/test_data_directory.h" |
10 #include "net/cert/cert_status_flags.h" | 10 #include "net/cert/cert_status_flags.h" |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 // TODO(rtenneti): Enable testing of ProofVerifier. See http://crbug.com/514468. | 111 // TODO(rtenneti): Enable testing of ProofVerifier. See http://crbug.com/514468. |
112 TEST(ProofTest, DISABLED_Verify) { | 112 TEST(ProofTest, DISABLED_Verify) { |
113 scoped_ptr<ProofSource> source(CryptoTestUtils::ProofSourceForTesting()); | 113 scoped_ptr<ProofSource> source(CryptoTestUtils::ProofSourceForTesting()); |
114 scoped_ptr<ProofVerifier> verifier( | 114 scoped_ptr<ProofVerifier> verifier( |
115 CryptoTestUtils::ProofVerifierForTesting()); | 115 CryptoTestUtils::ProofVerifierForTesting()); |
116 | 116 |
117 const string server_config = "server config bytes"; | 117 const string server_config = "server config bytes"; |
118 const string hostname = "test.example.com"; | 118 const string hostname = "test.example.com"; |
119 const vector<string>* certs; | 119 const vector<string>* certs; |
120 const vector<string>* first_certs; | 120 const vector<string>* first_certs; |
121 string error_details, signature, first_signature; | 121 string error_details, signature, first_signature, first_cert_sct, cert_sct; |
122 IPAddressNumber server_ip; | 122 IPAddressNumber server_ip; |
123 | 123 |
124 ASSERT_TRUE(source->GetProof(server_ip, hostname, server_config, | 124 ASSERT_TRUE(source->GetProof(server_ip, hostname, server_config, |
125 false /* no ECDSA */, &first_certs, | 125 false /* no ECDSA */, &first_certs, |
126 &first_signature)); | 126 &first_signature, &first_cert_sct)); |
127 ASSERT_TRUE(source->GetProof(server_ip, hostname, server_config, | 127 ASSERT_TRUE(source->GetProof(server_ip, hostname, server_config, |
128 false /* no ECDSA */, &certs, &signature)); | 128 false /* no ECDSA */, &certs, &signature, |
| 129 &cert_sct)); |
129 | 130 |
130 // Check that the proof source is caching correctly: | 131 // Check that the proof source is caching correctly: |
131 ASSERT_EQ(first_certs, certs); | 132 ASSERT_EQ(first_certs, certs); |
132 ASSERT_EQ(signature, first_signature); | 133 ASSERT_EQ(signature, first_signature); |
| 134 ASSERT_EQ(first_cert_sct, cert_sct); |
133 | 135 |
134 RunVerification( | 136 RunVerification( |
135 verifier.get(), hostname, server_config, *certs, signature, true); | 137 verifier.get(), hostname, server_config, *certs, signature, true); |
136 | 138 |
137 RunVerification( | 139 RunVerification( |
138 verifier.get(), "foo.com", server_config, *certs, signature, false); | 140 verifier.get(), "foo.com", server_config, *certs, signature, false); |
139 | 141 |
140 RunVerification( | 142 RunVerification( |
141 verifier.get(), server_config.substr(1, string::npos), server_config, | 143 verifier.get(), server_config.substr(1, string::npos), server_config, |
142 *certs, signature, false); | 144 *certs, signature, false); |
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
365 wrong_certs.push_back(certs[i]); | 367 wrong_certs.push_back(certs[i]); |
366 } | 368 } |
367 RunVerification( | 369 RunVerification( |
368 verifier.get(), hostname, server_config, wrong_certs, signature, | 370 verifier.get(), hostname, server_config, wrong_certs, signature, |
369 false); | 371 false); |
370 } | 372 } |
371 } | 373 } |
372 | 374 |
373 } // namespace test | 375 } // namespace test |
374 } // namespace net | 376 } // namespace net |
OLD | NEW |