| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "net/test/test_server.h" | 5 #include "net/test/test_server.h" |
| 6 | 6 |
| 7 #include <windows.h> | 7 #include <windows.h> |
| 8 #include <wincrypt.h> | 8 #include <wincrypt.h> |
| 9 | 9 |
| 10 #include "base/base_paths.h" | 10 #include "base/base_paths.h" |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 child_read_fd_.Close(); | 165 child_read_fd_.Close(); |
| 166 child_write_fd_.Close(); | 166 child_write_fd_.Close(); |
| 167 | 167 |
| 168 // If we hit the timeout, fail. | 168 // If we hit the timeout, fail. |
| 169 if (unblocked) | 169 if (unblocked) |
| 170 return false; | 170 return false; |
| 171 | 171 |
| 172 return result && bytes_read > 0; | 172 return result && bytes_read > 0; |
| 173 } | 173 } |
| 174 | 174 |
| 175 bool TestServer::CheckCATrusted() { | |
| 176 HCERTSTORE cert_store = CertOpenSystemStore(NULL, L"ROOT"); | |
| 177 if (!cert_store) { | |
| 178 LOG(ERROR) << " could not open trusted root CA store"; | |
| 179 return false; | |
| 180 } | |
| 181 PCCERT_CONTEXT cert = | |
| 182 CertFindCertificateInStore(cert_store, | |
| 183 X509_ASN_ENCODING | PKCS_7_ASN_ENCODING, | |
| 184 0, | |
| 185 CERT_FIND_ISSUER_STR, | |
| 186 L"Test CA", | |
| 187 NULL); | |
| 188 if (cert) | |
| 189 CertFreeCertificateContext(cert); | |
| 190 CertCloseStore(cert_store, 0); | |
| 191 | |
| 192 if (!cert) { | |
| 193 LOG(ERROR) << " TEST CONFIGURATION ERROR: you need to import the test ca " | |
| 194 "certificate to your trusted roots for this test to work. " | |
| 195 "For more info visit:\n" | |
| 196 "http://dev.chromium.org/developers/testing\n"; | |
| 197 return false; | |
| 198 } | |
| 199 | |
| 200 return true; | |
| 201 } | |
| 202 | |
| 203 } // namespace net | 175 } // namespace net |
| OLD | NEW |