| Index: components/cast_certificate/cast_cert_validator_unittest.cc
|
| diff --git a/components/cast_certificate/cast_cert_validator_unittest.cc b/components/cast_certificate/cast_cert_validator_unittest.cc
|
| index e363a1d47c859bbf0f6b1646689cb7ff6fabc6f0..30b5c38846d908125cc13ce58a4d67af1340d03d 100644
|
| --- a/components/cast_certificate/cast_cert_validator_unittest.cc
|
| +++ b/components/cast_certificate/cast_cert_validator_unittest.cc
|
| @@ -39,14 +39,15 @@ void RunTest(TestResult expected_result,
|
| const std::string& expected_common_name,
|
| CastDeviceCertPolicy expected_policy,
|
| const std::string& certs_file_name,
|
| - const base::Time::Exploded& time,
|
| + const base::Time& time,
|
| const std::string& optional_signed_data_file_name) {
|
| auto certs =
|
| cast_certificate::testing::ReadCertificateChainFromFile(certs_file_name);
|
|
|
| std::unique_ptr<CertVerificationContext> context;
|
| CastDeviceCertPolicy policy;
|
| - bool result = VerifyDeviceCert(certs, time, &context, &policy);
|
| + bool result = VerifyDeviceCert(certs, time, &context, &policy, nullptr,
|
| + CRLPolicy::CRL_OPTIONAL);
|
|
|
| if (expected_result == RESULT_FAIL) {
|
| ASSERT_FALSE(result);
|
| @@ -89,33 +90,39 @@ void RunTest(TestResult expected_result,
|
| }
|
|
|
| // Creates a time in UTC at midnight.
|
| -base::Time::Exploded CreateDate(int year, int month, int day) {
|
| +//
|
| +// The maximum date usable here is limited to year 2038 on 32 bit systems due to
|
| +// base::Time::FromExploded clamping the range to what is supported by mktime
|
| +// and timegm.
|
| +base::Time CreateDate(int year, int month, int day) {
|
| base::Time::Exploded time = {0};
|
| time.year = year;
|
| time.month = month;
|
| time.day_of_month = day;
|
| - return time;
|
| + base::Time result;
|
| + EXPECT_TRUE(base::Time::FromUTCExploded(time, &result));
|
| + return result;
|
| }
|
|
|
| // Returns 2016-04-01 00:00:00 UTC.
|
| //
|
| // This is a time when most of the test certificate paths are
|
| // valid.
|
| -base::Time::Exploded AprilFirst2016() {
|
| +base::Time AprilFirst2016() {
|
| return CreateDate(2016, 4, 1);
|
| }
|
|
|
| // Returns 2015-01-01 00:00:00 UTC.
|
| -base::Time::Exploded JanuaryFirst2015() {
|
| +base::Time JanuaryFirst2015() {
|
| return CreateDate(2015, 1, 1);
|
| }
|
|
|
| -// Returns 2040-03-01 00:00:00 UTC.
|
| +// Returns 2037-03-01 00:00:00 UTC.
|
| //
|
| // This is so far in the future that the test chains in this unit-test
|
| // should all be invalid.
|
| -base::Time::Exploded MarchFirst2040() {
|
| - return CreateDate(2040, 3, 1);
|
| +base::Time MarchFirst2037() {
|
| + return CreateDate(2037, 3, 1);
|
| }
|
|
|
| // Tests verifying a valid certificate chain of length 2:
|
| @@ -258,7 +265,7 @@ TEST(VerifyCastDeviceCertTest, ChromecastGen2InvalidTime) {
|
|
|
| // Use a time after notAfter.
|
| RunTest(RESULT_FAIL, "", CastDeviceCertPolicy::NONE, kCertsFile,
|
| - MarchFirst2040(), "");
|
| + MarchFirst2037(), "");
|
| }
|
|
|
| // Tests verifying a valid certificate chain of length 3:
|
|
|