OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 <wintrust.h> | 6 #include <wintrust.h> |
7 | 7 |
8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
9 #include "base/files/memory_mapped_file.h" | 9 #include "base/files/memory_mapped_file.h" |
10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
(...skipping 17 matching lines...) Expand all Loading... |
28 size_t number_of_debug_entries; | 28 size_t number_of_debug_entries; |
29 }; | 29 }; |
30 | 30 |
31 // A test fixture parameterized on test data containing the name of a PE image | 31 // A test fixture parameterized on test data containing the name of a PE image |
32 // to parse and the expected values to be read from it. The file is read from | 32 // to parse and the expected values to be read from it. The file is read from |
33 // the src/chrome/test/data/safe_browsing directory. | 33 // the src/chrome/test/data/safe_browsing directory. |
34 class PeImageReaderTest : public testing::TestWithParam<const TestData*> { | 34 class PeImageReaderTest : public testing::TestWithParam<const TestData*> { |
35 protected: | 35 protected: |
36 PeImageReaderTest() : expected_data_(GetParam()) {} | 36 PeImageReaderTest() : expected_data_(GetParam()) {} |
37 | 37 |
38 virtual void SetUp() override { | 38 void SetUp() override { |
39 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &data_file_path_)); | 39 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &data_file_path_)); |
40 data_file_path_ = data_file_path_.AppendASCII("safe_browsing"); | 40 data_file_path_ = data_file_path_.AppendASCII("safe_browsing"); |
41 data_file_path_ = data_file_path_.AppendASCII(expected_data_->filename); | 41 data_file_path_ = data_file_path_.AppendASCII(expected_data_->filename); |
42 | 42 |
43 ASSERT_TRUE(data_file_.Initialize(data_file_path_)); | 43 ASSERT_TRUE(data_file_.Initialize(data_file_path_)); |
44 | 44 |
45 ASSERT_TRUE(image_reader_.Initialize(data_file_.data(), | 45 ASSERT_TRUE(image_reader_.Initialize(data_file_.data(), |
46 data_file_.length())); | 46 data_file_.length())); |
47 } | 47 } |
48 | 48 |
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
280 testing::Values(&kCertificateTestData[0])); | 280 testing::Values(&kCertificateTestData[0])); |
281 INSTANTIATE_TEST_CASE_P(UnsignedExe, | 281 INSTANTIATE_TEST_CASE_P(UnsignedExe, |
282 PeImageReaderCertificateTest, | 282 PeImageReaderCertificateTest, |
283 testing::Values(&kCertificateTestData[1])); | 283 testing::Values(&kCertificateTestData[1])); |
284 INSTANTIATE_TEST_CASE_P(WowHelperExe, | 284 INSTANTIATE_TEST_CASE_P(WowHelperExe, |
285 PeImageReaderCertificateTest, | 285 PeImageReaderCertificateTest, |
286 testing::Values(&kCertificateTestData[2])); | 286 testing::Values(&kCertificateTestData[2])); |
287 INSTANTIATE_TEST_CASE_P(SignedTwiceExe, | 287 INSTANTIATE_TEST_CASE_P(SignedTwiceExe, |
288 PeImageReaderCertificateTest, | 288 PeImageReaderCertificateTest, |
289 testing::Values(&kCertificateTestData[3])); | 289 testing::Values(&kCertificateTestData[3])); |
OLD | NEW |