Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(191)

Unified Diff: net/cert/x509_certificate_unittest.cc

Issue 2758803003: Make X509Certificate creation fail if X509Certificate::Initialize fails. (Closed)
Patch Set: test updatess 2 Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/cert/x509_certificate_openssl.cc ('k') | net/cert/x509_certificate_win.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/cert/x509_certificate_unittest.cc
diff --git a/net/cert/x509_certificate_unittest.cc b/net/cert/x509_certificate_unittest.cc
index f6c5ebac92a6bfa82d4f3608a8383b6050b46d72..da2545134cfbe88f2949c8fde5d0497949d11c5b 100644
--- a/net/cert/x509_certificate_unittest.cc
+++ b/net/cert/x509_certificate_unittest.cc
@@ -282,8 +282,12 @@ TEST(X509CertificateTest, SerialNumbers) {
EXPECT_TRUE(memcmp(google_cert->serial_number().data(), google_serial,
sizeof(google_serial)) == 0);
- // We also want to check a serial number where the first byte is >= 0x80 in
- // case the underlying library tries to pad it.
+// TODO(mattm): Creating the X509Certificate fails on windows due to the null
+// in the subject. Generate a new test cert specifically for this case rather
+// than reusing paypal_null_cert.
+#if !defined(OS_WIN)
+ // Check a serial number where the first byte is >= 0x80, the DER returned by
+ // serial() should contain the leading 0 padding byte.
scoped_refptr<X509Certificate> paypal_null_cert(
X509Certificate::CreateFromBytes(
reinterpret_cast<const char*>(paypal_null_der),
@@ -295,6 +299,7 @@ TEST(X509CertificateTest, SerialNumbers) {
paypal_null_cert->serial_number().size());
EXPECT_TRUE(memcmp(paypal_null_cert->serial_number().data(),
paypal_null_serial, sizeof(paypal_null_serial)) == 0);
+#endif // !defined(OS_WIN)
}
TEST(X509CertificateTest, SHA256FingerprintsCorrectly) {
« no previous file with comments | « net/cert/x509_certificate_openssl.cc ('k') | net/cert/x509_certificate_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698