Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/time/time.h" | 5 #include "base/time/time.h" |
| 6 #include "components/cast_certificate/cast_cert_validator.h" | 6 #include "components/cast_certificate/cast_cert_validator.h" |
| 7 #include "components/cast_certificate/cast_cert_validator_test_helpers.h" | 7 #include "components/cast_certificate/cast_cert_validator_test_helpers.h" |
| 8 #include "components/cast_certificate/cast_crl.h" | 8 #include "components/cast_certificate/cast_crl.h" |
| 9 #include "components/cast_certificate/proto/test_suite.pb.h" | 9 #include "components/cast_certificate/proto/test_suite.pb.h" |
| 10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 83 if (expected_result != RESULT_SUCCESS) { | 83 if (expected_result != RESULT_SUCCESS) { |
| 84 EXPECT_FALSE(result); | 84 EXPECT_FALSE(result); |
| 85 return !result; | 85 return !result; |
| 86 } | 86 } |
| 87 EXPECT_TRUE(result); | 87 EXPECT_TRUE(result); |
| 88 return result; | 88 return result; |
| 89 } | 89 } |
| 90 | 90 |
| 91 // Runs a single test case. | 91 // Runs a single test case. |
| 92 bool RunTest(const DeviceCertTest& test_case) { | 92 bool RunTest(const DeviceCertTest& test_case) { |
| 93 ResetCRLTrustAnchorForTest(); | |
|
eroman
2016/08/03 22:47:58
This seems problematic, in that running the tests
ryanchung
2016/08/04 18:46:43
Done. Went with solution a).
Thanks!
| |
| 94 ResetTrustAnchorForTest(); | |
| 93 bool use_test_trust_anchors = test_case.use_test_trust_anchors(); | 95 bool use_test_trust_anchors = test_case.use_test_trust_anchors(); |
| 94 if (use_test_trust_anchors) { | 96 if (use_test_trust_anchors) { |
| 95 const auto crl_test_root = | 97 const auto crl_test_root = |
| 96 cast_certificate::testing::ReadCertificateChainFromFile( | 98 cast_certificate::testing::ReadCertificateChainFromFile( |
| 97 "certificates/cast_crl_test_root_ca.pem"); | 99 "certificates/cast_crl_test_root_ca.pem"); |
| 98 EXPECT_EQ(crl_test_root.size(), 1u); | 100 EXPECT_EQ(crl_test_root.size(), 1u); |
| 99 EXPECT_TRUE(SetCRLTrustAnchorForTest(crl_test_root[0])); | 101 EXPECT_TRUE(SetCRLTrustAnchorForTest(crl_test_root[0])); |
| 100 const auto cast_test_root = | 102 const auto cast_test_root = |
| 101 cast_certificate::testing::ReadCertificateChainFromFile( | 103 cast_certificate::testing::ReadCertificateChainFromFile( |
| 102 "certificates/cast_test_root_ca.pem"); | 104 "certificates/cast_test_root_ca.pem"); |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 196 } | 198 } |
| 197 } | 199 } |
| 198 | 200 |
| 199 TEST(CastCertificateTest, TestSuite1) { | 201 TEST(CastCertificateTest, TestSuite1) { |
| 200 RunTestSuite("testsuite/testsuite1.pb"); | 202 RunTestSuite("testsuite/testsuite1.pb"); |
| 201 } | 203 } |
| 202 | 204 |
| 203 } // namespace | 205 } // namespace |
| 204 | 206 |
| 205 } // namespace cast_certificate | 207 } // namespace cast_certificate |
| OLD | NEW |