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 <stdint.h> | 5 #include <stdint.h> |
6 #include <windows.h> | 6 #include <windows.h> |
7 | 7 |
8 #include <algorithm> | 8 #include <algorithm> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 dll = dll.Append(L"chrome_elf.dll"); | 54 dll = dll.Append(L"chrome_elf.dll"); |
55 GetImports(dll, &elf_imports); | 55 GetImports(dll, &elf_imports); |
56 | 56 |
57 // Check that ELF has imports. | 57 // Check that ELF has imports. |
58 ASSERT_LT(0u, elf_imports.size()) << "Ensure the chrome_elf_unittests " | 58 ASSERT_LT(0u, elf_imports.size()) << "Ensure the chrome_elf_unittests " |
59 "target was built, instead of chrome_elf_unittests.exe"; | 59 "target was built, instead of chrome_elf_unittests.exe"; |
60 | 60 |
61 std::vector<std::string>::iterator it(elf_imports.begin()); | 61 std::vector<std::string>::iterator it(elf_imports.begin()); |
62 | 62 |
63 static const char* const kValidFilePatterns[] = { | 63 static const char* const kValidFilePatterns[] = { |
| 64 "base.dll", // For breakpad support. |
64 "KERNEL32.dll", | 65 "KERNEL32.dll", |
65 "MSVC*", | 66 "MSVC*", |
66 #if defined(ADDRESS_SANITIZER) | 67 #if defined(ADDRESS_SANITIZER) |
67 "syzyasan_rtl.dll", | 68 "syzyasan_rtl.dll", |
68 #endif | 69 #endif |
69 "ADVAPI32.dll"}; | 70 "ADVAPI32.dll"}; |
70 | 71 |
71 // Make sure all of ELF's imports are in the valid imports list. | 72 // Make sure all of ELF's imports are in the valid imports list. |
72 for (; it != elf_imports.end(); it++) { | 73 for (; it != elf_imports.end(); it++) { |
73 bool match = false; | 74 bool match = false; |
(...skipping 23 matching lines...) Expand all Loading... |
97 ASSERT_LT(0u, exe_imports.size()) << "Ensure the chrome_elf_unittests " | 98 ASSERT_LT(0u, exe_imports.size()) << "Ensure the chrome_elf_unittests " |
98 "target was built, instead of chrome_elf_unittests.exe"; | 99 "target was built, instead of chrome_elf_unittests.exe"; |
99 | 100 |
100 // Chrome.exe's first import must be ELF. | 101 // Chrome.exe's first import must be ELF. |
101 EXPECT_EQ("chrome_elf.dll", exe_imports[0]) << | 102 EXPECT_EQ("chrome_elf.dll", exe_imports[0]) << |
102 "Illegal import order in chrome.exe (ensure the chrome_elf_unittest " | 103 "Illegal import order in chrome.exe (ensure the chrome_elf_unittest " |
103 "target was built, instead of just chrome_elf_unittests.exe)"; | 104 "target was built, instead of just chrome_elf_unittests.exe)"; |
104 } | 105 } |
105 | 106 |
106 } // namespace | 107 } // namespace |
OLD | NEW |