Index: net/cert/x509_cert_types_unittest.cc |
diff --git a/net/cert/x509_cert_types_unittest.cc b/net/cert/x509_cert_types_unittest.cc |
index 50275f0eb010f7cb253fab4ca4c78ec7500c93e5..6d7092de7740cfecd480213e05d344d4ae023ef2 100644 |
--- a/net/cert/x509_cert_types_unittest.cc |
+++ b/net/cert/x509_cert_types_unittest.cc |
@@ -182,18 +182,21 @@ const struct CertDateTestData { |
"20120101123000Z", |
true, |
{2012, 1, 0, 1, 12, 30, 0}}, |
+ // test 31st of April |
+ {CERT_DATE_FORMAT_GENERALIZED_TIME, "20160431121000Z", false, {0}}, |
+ // test 31st of February |
+ {CERT_DATE_FORMAT_GENERALIZED_TIME, "20160231121000Z", false, {0}}, |
}; |
// GTest pretty printer. |
void PrintTo(const CertDateTestData& data, std::ostream* os) { |
+ base::Time out_time; |
+ bool result = base::Time::FromUTCExploded(data.expected_result, &out_time); |
*os << " format: " << data.format |
<< "; date string: " << base::StringPiece(data.date_string) |
- << "; valid: " << data.is_valid |
- << "; expected date: " |
- << (data.is_valid ? |
- base::Time::FromUTCExploded(data.expected_result) |
- .ToInternalValue() : |
- 0U); |
+ << "; valid: " << data.is_valid << "; expected date: " |
+ << (data.is_valid ? out_time.ToInternalValue() : 0U) |
+ << "; FromUTCExploded conversion result: " << result; |
} |
class X509CertTypesDateTest : public testing::TestWithParam<CertDateTestData> { |
@@ -212,14 +215,15 @@ TEST_P(X509CertTypesDateTest, Parse) { |
EXPECT_EQ(test_data_.is_valid, parsed); |
if (!test_data_.is_valid) |
return; |
- // Convert the expected value to a base::Time(). This ensures that systems |
+ // Convert the expected value to a base::Time(). This ensures that |
// systems that only support 32-bit times will pass the tests, by ensuring at |
// least that the times have the same truncating behaviour. |
// Note: Compared as internal values so that mismatches can be cleanly |
// printed by GTest (eg: without PrintTo overrides). |
- EXPECT_EQ(base::Time::FromUTCExploded(test_data_.expected_result) |
- .ToInternalValue(), |
- parsed_date.ToInternalValue()); |
+ base::Time out_time; |
+ EXPECT_TRUE( |
+ base::Time::FromUTCExploded(test_data_.expected_result, &out_time)); |
eroman
2016/12/08 01:39:19
Please see my earlier comments on this matter.
Th
maksims (do not use this acc)
2016/12/13 08:56:09
Done.
|
+ EXPECT_EQ(out_time.ToInternalValue(), parsed_date.ToInternalValue()); |
} |
INSTANTIATE_TEST_CASE_P(, |
X509CertTypesDateTest, |