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 "extensions/common/cast/cast_cert_validator.h" | 5 #include "extensions/common/cast/cast_cert_validator.h" |
6 | 6 |
7 #include "extensions/common/cast/cast_cert_validator_test_helpers.h" | 7 #include "extensions/common/cast/cast_cert_validator_test_helpers.h" |
8 #include "testing/gtest/include/gtest/gtest.h" | 8 #include "testing/gtest/include/gtest/gtest.h" |
9 | 9 |
10 namespace extensions { | 10 namespace extensions { |
(...skipping 29 matching lines...) Expand all Loading... |
40 // a valid signature generated by the device certificate. | 40 // a valid signature generated by the device certificate. |
41 // | 41 // |
42 void RunTest(TestResult expected_result, | 42 void RunTest(TestResult expected_result, |
43 const std::string& expected_common_name, | 43 const std::string& expected_common_name, |
44 CastDeviceCertPolicy expected_policy, | 44 CastDeviceCertPolicy expected_policy, |
45 const std::string& certs_file_name, | 45 const std::string& certs_file_name, |
46 const base::Time::Exploded& time, | 46 const base::Time::Exploded& time, |
47 const std::string& optional_signed_data_file_name) { | 47 const std::string& optional_signed_data_file_name) { |
48 auto certs = cast_test_helpers::ReadCertificateChainFromFile(certs_file_name); | 48 auto certs = cast_test_helpers::ReadCertificateChainFromFile(certs_file_name); |
49 | 49 |
50 scoped_ptr<CertVerificationContext> context; | 50 std::unique_ptr<CertVerificationContext> context; |
51 CastDeviceCertPolicy policy; | 51 CastDeviceCertPolicy policy; |
52 bool result = VerifyDeviceCert(certs, time, &context, &policy); | 52 bool result = VerifyDeviceCert(certs, time, &context, &policy); |
53 | 53 |
54 if (expected_result == RESULT_FAIL) { | 54 if (expected_result == RESULT_FAIL) { |
55 ASSERT_FALSE(result); | 55 ASSERT_FALSE(result); |
56 return; | 56 return; |
57 } | 57 } |
58 | 58 |
59 ASSERT_TRUE(result); | 59 ASSERT_TRUE(result); |
60 EXPECT_EQ(expected_policy, policy); | 60 EXPECT_EQ(expected_policy, policy); |
(...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
414 CreateString(kEx2Message))); | 414 CreateString(kEx2Message))); |
415 } | 415 } |
416 | 416 |
417 } // namespace | 417 } // namespace |
418 | 418 |
419 } // namespace cast_crypto | 419 } // namespace cast_crypto |
420 | 420 |
421 } // namespace api | 421 } // namespace api |
422 | 422 |
423 } // namespace extensions | 423 } // namespace extensions |
OLD | NEW |