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 #include "base/files/file_path.h" | 5 #include "base/files/file_path.h" |
6 #include "build/build_config.h" | 6 #include "build/build_config.h" |
7 #include "net/base/net_errors.h" | 7 #include "net/base/net_errors.h" |
8 #include "net/cert/cert_status_flags.h" | 8 #include "net/cert/cert_status_flags.h" |
9 #include "net/cert/cert_verify_proc.h" | 9 #include "net/cert/cert_verify_proc.h" |
10 #include "net/cert/cert_verify_result.h" | 10 #include "net/cert/cert_verify_result.h" |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 int restored_status = | 122 int restored_status = |
123 verify_proc->Verify(test_cert.get(), "127.0.0.1", std::string(), flags, | 123 verify_proc->Verify(test_cert.get(), "127.0.0.1", std::string(), flags, |
124 NULL, CertificateList(), &restored_verify_result); | 124 NULL, CertificateList(), &restored_verify_result); |
125 EXPECT_NE(OK, restored_status); | 125 EXPECT_NE(OK, restored_status); |
126 EXPECT_NE(0u, | 126 EXPECT_NE(0u, |
127 restored_verify_result.cert_status & CERT_STATUS_AUTHORITY_INVALID); | 127 restored_verify_result.cert_status & CERT_STATUS_AUTHORITY_INVALID); |
128 EXPECT_EQ(bad_status, restored_status); | 128 EXPECT_EQ(bad_status, restored_status); |
129 EXPECT_EQ(bad_verify_result.cert_status, restored_verify_result.cert_status); | 129 EXPECT_EQ(bad_verify_result.cert_status, restored_verify_result.cert_status); |
130 } | 130 } |
131 | 131 |
132 #if defined(USE_NSS_CERTS) || \ | 132 #if defined(USE_NSS_CERTS) |
133 (defined(USE_OPENSSL_CERTS) && !defined(OS_ANDROID)) | |
134 TEST(TestRootCertsTest, Contains) { | 133 TEST(TestRootCertsTest, Contains) { |
135 // Another test root certificate. | 134 // Another test root certificate. |
136 const char kRootCertificateFile2[] = "2048-rsa-root.pem"; | 135 const char kRootCertificateFile2[] = "2048-rsa-root.pem"; |
137 | 136 |
138 TestRootCerts* test_roots = TestRootCerts::GetInstance(); | 137 TestRootCerts* test_roots = TestRootCerts::GetInstance(); |
139 ASSERT_NE(static_cast<TestRootCerts*>(NULL), test_roots); | 138 ASSERT_NE(static_cast<TestRootCerts*>(NULL), test_roots); |
140 | 139 |
141 scoped_refptr<X509Certificate> root_cert_1 = | 140 scoped_refptr<X509Certificate> root_cert_1 = |
142 ImportCertFromFile(GetTestCertsDirectory(), kRootCertificateFile); | 141 ImportCertFromFile(GetTestCertsDirectory(), kRootCertificateFile); |
143 ASSERT_NE(static_cast<X509Certificate*>(NULL), root_cert_1.get()); | 142 ASSERT_NE(static_cast<X509Certificate*>(NULL), root_cert_1.get()); |
(...skipping 17 matching lines...) Expand all Loading... |
161 EXPECT_FALSE(test_roots->Contains(root_cert_1->os_cert_handle())); | 160 EXPECT_FALSE(test_roots->Contains(root_cert_1->os_cert_handle())); |
162 EXPECT_FALSE(test_roots->Contains(root_cert_2->os_cert_handle())); | 161 EXPECT_FALSE(test_roots->Contains(root_cert_2->os_cert_handle())); |
163 } | 162 } |
164 #endif | 163 #endif |
165 | 164 |
166 // TODO(rsleevi): Add tests for revocation checking via CRLs, ensuring that | 165 // TODO(rsleevi): Add tests for revocation checking via CRLs, ensuring that |
167 // TestRootCerts properly injects itself into the validation process. See | 166 // TestRootCerts properly injects itself into the validation process. See |
168 // http://crbug.com/63958 | 167 // http://crbug.com/63958 |
169 | 168 |
170 } // namespace net | 169 } // namespace net |
OLD | NEW |