OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 <windows.h> | 5 #include <windows.h> |
6 #include <atlstr.h> | 6 #include <atlstr.h> |
7 #include <wincrypt.h> | 7 #include <wincrypt.h> |
8 #include <wintrust.h> | 8 #include <wintrust.h> |
9 | 9 |
10 #include "base/base_paths.h" | 10 #include "base/base_paths.h" |
(...skipping 18 matching lines...) Expand all Loading... |
29 | 29 |
30 const base::FilePath::CharType kCertificateRelativePath[] = | 30 const base::FilePath::CharType kCertificateRelativePath[] = |
31 FILE_PATH_LITERAL("chrome\\app\\test_data\\certificates\\"); | 31 FILE_PATH_LITERAL("chrome\\app\\test_data\\certificates\\"); |
32 const base::FilePath::CharType kDLLRelativePath[] = | 32 const base::FilePath::CharType kDLLRelativePath[] = |
33 FILE_PATH_LITERAL("chrome\\app\\test_data\\dlls\\"); | 33 FILE_PATH_LITERAL("chrome\\app\\test_data\\dlls\\"); |
34 | 34 |
35 class SignatureValidatorTest : public testing::Test { | 35 class SignatureValidatorTest : public testing::Test { |
36 protected: | 36 protected: |
37 SignatureValidatorTest() {} | 37 SignatureValidatorTest() {} |
38 | 38 |
39 void SetUp() OVERRIDE { | 39 void SetUp() override { |
40 test_roots_ = net::TestRootCerts::GetInstance(); | 40 test_roots_ = net::TestRootCerts::GetInstance(); |
41 base::FilePath cert_path = | 41 base::FilePath cert_path = |
42 GetTestCertsDirectory().Append(L"AuthorityCert.cer"); | 42 GetTestCertsDirectory().Append(L"AuthorityCert.cer"); |
43 base::FilePath other_cert_path = | 43 base::FilePath other_cert_path = |
44 GetTestCertsDirectory().Append(L"OtherAuthorityCert.cer"); | 44 GetTestCertsDirectory().Append(L"OtherAuthorityCert.cer"); |
45 test_roots_->AddFromFile(cert_path); | 45 test_roots_->AddFromFile(cert_path); |
46 test_roots_->AddFromFile(other_cert_path); | 46 test_roots_->AddFromFile(other_cert_path); |
47 EXPECT_FALSE(test_roots_->IsEmpty()); | 47 EXPECT_FALSE(test_roots_->IsEmpty()); |
48 | 48 |
49 SetExpectedHash(GetTestCertsDirectory().Append(L"ValidCert.cer")); | 49 SetExpectedHash(GetTestCertsDirectory().Append(L"ValidCert.cer")); |
50 } | 50 } |
51 | 51 |
52 void TearDown() OVERRIDE { | 52 void TearDown() override { |
53 test_roots_->Clear(); | 53 test_roots_->Clear(); |
54 EXPECT_TRUE(test_roots_->IsEmpty()); | 54 EXPECT_TRUE(test_roots_->IsEmpty()); |
55 } | 55 } |
56 | 56 |
57 base::FilePath GetTestCertsDirectory() { | 57 base::FilePath GetTestCertsDirectory() { |
58 base::FilePath src_root; | 58 base::FilePath src_root; |
59 PathService::Get(base::DIR_SOURCE_ROOT, &src_root); | 59 PathService::Get(base::DIR_SOURCE_ROOT, &src_root); |
60 return src_root.Append(kCertificateRelativePath); | 60 return src_root.Append(kCertificateRelativePath); |
61 } | 61 } |
62 | 62 |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 TEST_F(SignatureValidatorTest, CertPinningTest) { | 122 TEST_F(SignatureValidatorTest, CertPinningTest) { |
123 RunTest(L"different_hash.dll", true, false); | 123 RunTest(L"different_hash.dll", true, false); |
124 } | 124 } |
125 | 125 |
126 TEST_F(SignatureValidatorTest, ExpiredCertTest) { | 126 TEST_F(SignatureValidatorTest, ExpiredCertTest) { |
127 //TODO(caitkp): Figure out how to sign a dll with an expired cert. | 127 //TODO(caitkp): Figure out how to sign a dll with an expired cert. |
128 RunTest(L"expired.dll", false, false); | 128 RunTest(L"expired.dll", false, false); |
129 } | 129 } |
130 | 130 |
131 | 131 |
OLD | NEW |