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 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
179 return false; | 179 return false; |
180 | 180 |
181 // If not enough bytes were read, fail. | 181 // If not enough bytes were read, fail. |
182 if (bytes_read < bytes_max) | 182 if (bytes_read < bytes_max) |
183 return false; | 183 return false; |
184 | 184 |
185 host_port_pair_.set_port(port); | 185 host_port_pair_.set_port(port); |
186 return true; | 186 return true; |
187 } | 187 } |
188 | 188 |
189 bool TestServer::CheckCATrusted() { | |
190 HCERTSTORE cert_store = CertOpenSystemStore(NULL, L"ROOT"); | |
191 if (!cert_store) { | |
192 LOG(ERROR) << " could not open trusted root CA store"; | |
193 return false; | |
194 } | |
195 PCCERT_CONTEXT cert = | |
196 CertFindCertificateInStore(cert_store, | |
197 X509_ASN_ENCODING | PKCS_7_ASN_ENCODING, | |
198 0, | |
199 CERT_FIND_ISSUER_STR, | |
200 L"Test CA", | |
201 NULL); | |
202 if (cert) | |
203 CertFreeCertificateContext(cert); | |
204 CertCloseStore(cert_store, 0); | |
205 | |
206 if (!cert) { | |
207 LOG(ERROR) << " TEST CONFIGURATION ERROR: you need to import the test ca " | |
208 "certificate to your trusted roots for this test to work. " | |
209 "For more info visit:\n" | |
210 "http://dev.chromium.org/developers/testing\n"; | |
211 return false; | |
212 } | |
213 | |
214 return true; | |
215 } | |
216 | |
217 } // namespace net | 189 } // namespace net |
OLD | NEW |