OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/port.h" | 5 #include "base/port.h" |
6 #include "net/base/cert_status_flags.h" | 6 #include "net/base/cert_status_flags.h" |
7 #include "net/base/x509_certificate.h" | 7 #include "net/base/x509_certificate.h" |
8 #include "testing/gtest/include/gtest/gtest.h" | 8 #include "testing/gtest/include/gtest/gtest.h" |
9 | 9 |
10 // Unit tests aren't allowed to access external resources. Unfortunately, to | 10 // Unit tests aren't allowed to access external resources. Unfortunately, to |
11 // properly verify the EV-ness of a cert, we need to check for its revocation | 11 // properly verify the EV-ness of a cert, we need to check for its revocation |
12 // through online servers. If you're manually running unit tests, feel free to | 12 // through online servers. If you're manually running unit tests, feel free to |
13 // turn this on to test EV certs. But leave it turned off for the automated | 13 // turn this on to test EV certs. But leave it turned off for the automated |
14 // testing. | 14 // testing. |
15 #define ALLOW_EXTERNAL_ACCESS 0 | 15 #define ALLOW_EXTERNAL_ACCESS 0 |
16 | 16 |
| 17 using base::Time; |
| 18 |
17 namespace { | 19 namespace { |
18 | 20 |
19 class X509CertificateTest : public testing::Test { | 21 class X509CertificateTest : public testing::Test { |
20 }; | 22 }; |
21 | 23 |
22 // Certificates for test data. They're obtained with: | 24 // Certificates for test data. They're obtained with: |
23 // | 25 // |
24 // $ openssl s_client -connect [host]:443 -showcerts | 26 // $ openssl s_client -connect [host]:443 -showcerts |
25 // $ openssl x509 -inform PEM -outform DER > /tmp/host.der | 27 // $ openssl x509 -inform PEM -outform DER > /tmp/host.der |
26 // $ xxd -i /tmp/host.der | 28 // $ xxd -i /tmp/host.der |
(...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
481 EXPECT_EQ("www.thawte.com", dns_names[0]); | 483 EXPECT_EQ("www.thawte.com", dns_names[0]); |
482 | 484 |
483 #if ALLOW_EXTERNAL_ACCESS && defined(OS_WIN) | 485 #if ALLOW_EXTERNAL_ACCESS && defined(OS_WIN) |
484 // EV cert verification requires revocation checking. | 486 // EV cert verification requires revocation checking. |
485 EXPECT_EQ(true, thawte_cert->IsEV(net::CERT_STATUS_REV_CHECKING_ENABLED)); | 487 EXPECT_EQ(true, thawte_cert->IsEV(net::CERT_STATUS_REV_CHECKING_ENABLED)); |
486 // Consequently, if we don't have revocation checking enabled, we can't claim | 488 // Consequently, if we don't have revocation checking enabled, we can't claim |
487 // any cert is EV. | 489 // any cert is EV. |
488 EXPECT_EQ(false, thawte_cert->IsEV(0)); | 490 EXPECT_EQ(false, thawte_cert->IsEV(0)); |
489 #endif | 491 #endif |
490 } | 492 } |
OLD | NEW |