| 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/net_errors.h" | 6 #include "net/base/net_errors.h" |
| 7 #include "net/base/test_completion_callback.h" | 7 #include "net/base/test_completion_callback.h" |
| 8 #include "net/base/test_data_directory.h" | 8 #include "net/base/test_data_directory.h" |
| 9 #include "net/cert/cert_status_flags.h" | 9 #include "net/cert/cert_status_flags.h" |
| 10 #include "net/cert/cert_verify_result.h" | 10 #include "net/cert/cert_verify_result.h" |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 bool expected_ok) { | 63 bool expected_ok) { |
| 64 scoped_ptr<ProofVerifyDetails> details; | 64 scoped_ptr<ProofVerifyDetails> details; |
| 65 TestCompletionCallback comp_callback; | 65 TestCompletionCallback comp_callback; |
| 66 bool ok; | 66 bool ok; |
| 67 string error_details; | 67 string error_details; |
| 68 scoped_ptr<ProofVerifyContext> verify_context( | 68 scoped_ptr<ProofVerifyContext> verify_context( |
| 69 CryptoTestUtils::ProofVerifyContextForTesting()); | 69 CryptoTestUtils::ProofVerifyContextForTesting()); |
| 70 TestProofVerifierCallback* callback = | 70 TestProofVerifierCallback* callback = |
| 71 new TestProofVerifierCallback(&comp_callback, &ok, &error_details); | 71 new TestProofVerifierCallback(&comp_callback, &ok, &error_details); |
| 72 | 72 |
| 73 ProofVerifier::Status status = verifier->VerifyProof( | 73 QuicAsyncStatus status = verifier->VerifyProof( |
| 74 hostname, server_config, certs, proof, verify_context.get(), | 74 hostname, server_config, certs, proof, verify_context.get(), |
| 75 &error_details, &details, callback); | 75 &error_details, &details, callback); |
| 76 | 76 |
| 77 switch (status) { | 77 switch (status) { |
| 78 case ProofVerifier::FAILURE: | 78 case QUIC_FAILURE: |
| 79 delete callback; | 79 delete callback; |
| 80 ASSERT_FALSE(expected_ok); | 80 ASSERT_FALSE(expected_ok); |
| 81 ASSERT_NE("", error_details); | 81 ASSERT_NE("", error_details); |
| 82 return; | 82 return; |
| 83 case ProofVerifier::SUCCESS: | 83 case QUIC_SUCCESS: |
| 84 delete callback; | 84 delete callback; |
| 85 ASSERT_TRUE(expected_ok); | 85 ASSERT_TRUE(expected_ok); |
| 86 ASSERT_EQ("", error_details); | 86 ASSERT_EQ("", error_details); |
| 87 return; | 87 return; |
| 88 case ProofVerifier::PENDING: | 88 case QUIC_PENDING: |
| 89 comp_callback.WaitForResult(); | 89 comp_callback.WaitForResult(); |
| 90 ASSERT_EQ(expected_ok, ok); | 90 ASSERT_EQ(expected_ok, ok); |
| 91 break; | 91 break; |
| 92 } | 92 } |
| 93 } | 93 } |
| 94 | 94 |
| 95 // Reads the certificate named "quic_" + |file_name| in the test data directory. | 95 // Reads the certificate named "quic_" + |file_name| in the test data directory. |
| 96 // The certificate must be PEM encoded. Returns the DER-encoded certificate. | 96 // The certificate must be PEM encoded. Returns the DER-encoded certificate. |
| 97 string LoadTestCert(const string& file_name) { | 97 string LoadTestCert(const string& file_name) { |
| 98 base::FilePath certs_dir = GetTestCertsDirectory(); | 98 base::FilePath certs_dir = GetTestCertsDirectory(); |
| (...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 362 wrong_certs.push_back(certs[i]); | 362 wrong_certs.push_back(certs[i]); |
| 363 } | 363 } |
| 364 RunVerification( | 364 RunVerification( |
| 365 verifier.get(), hostname, server_config, wrong_certs, signature, | 365 verifier.get(), hostname, server_config, wrong_certs, signature, |
| 366 false); | 366 false); |
| 367 } | 367 } |
| 368 } | 368 } |
| 369 | 369 |
| 370 } // namespace test | 370 } // namespace test |
| 371 } // namespace net | 371 } // namespace net |
| OLD | NEW |