| 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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 for (; it != elf_imports.end(); it++) { | 72 for (; it != elf_imports.end(); it++) { |
| 73 bool match = false; | 73 bool match = false; |
| 74 for (int i = 0; i < arraysize(kValidFilePatterns); ++i) { | 74 for (int i = 0; i < arraysize(kValidFilePatterns); ++i) { |
| 75 if (MatchPattern(*it, kValidFilePatterns[i])) | 75 if (MatchPattern(*it, kValidFilePatterns[i])) |
| 76 match = true; | 76 match = true; |
| 77 } | 77 } |
| 78 ASSERT_TRUE(match) << "Illegal import in chrome_elf.dll."; | 78 ASSERT_TRUE(match) << "Illegal import in chrome_elf.dll."; |
| 79 } | 79 } |
| 80 } | 80 } |
| 81 | 81 |
| 82 #if defined(ARCH_CPU_64_BITS) | 82 TEST_F(ELFImportsTest, ChromeExeSanityCheck) { |
| 83 #define MAYBE_ChromeExeSanityCheck DISABLED_ChromeExeSanityCheck | |
| 84 #else | |
| 85 #define MAYBE_ChromeExeSanityCheck ChromeExeSanityCheck | |
| 86 #endif | |
| 87 // Fails on 64-bit Windows, see http://crbug.com/335173. | |
| 88 TEST_F(ELFImportsTest, MAYBE_ChromeExeSanityCheck) { | |
| 89 std::vector<std::string> exe_imports; | 83 std::vector<std::string> exe_imports; |
| 90 | 84 |
| 91 base::FilePath exe; | 85 base::FilePath exe; |
| 92 ASSERT_TRUE(PathService::Get(base::DIR_EXE, &exe)); | 86 ASSERT_TRUE(PathService::Get(base::DIR_EXE, &exe)); |
| 93 exe = exe.Append(L"chrome.exe"); | 87 exe = exe.Append(L"chrome.exe"); |
| 94 GetImports(exe, &exe_imports); | 88 GetImports(exe, &exe_imports); |
| 95 | 89 |
| 96 // Check that chrome.exe has imports. | 90 // Check that chrome.exe has imports. |
| 97 ASSERT_LT(0u, exe_imports.size()) << "Ensure the chrome_elf_unittests " | 91 ASSERT_LT(0u, exe_imports.size()) << "Ensure the chrome_elf_unittests " |
| 98 "target was built, instead of chrome_elf_unittests.exe"; | 92 "target was built, instead of chrome_elf_unittests.exe"; |
| 99 | 93 |
| 100 // Chrome.exe's first import must be ELF. | 94 // Chrome.exe's first import must be ELF. |
| 101 EXPECT_EQ("chrome_elf.dll", exe_imports[0]) << | 95 EXPECT_EQ("chrome_elf.dll", exe_imports[0]) << |
| 102 "Illegal import order in chrome.exe (ensure the chrome_elf_unittest " | 96 "Illegal import order in chrome.exe (ensure the chrome_elf_unittest " |
| 103 "target was built, instead of just chrome_elf_unittests.exe)"; | 97 "target was built, instead of just chrome_elf_unittests.exe)"; |
| 104 } | 98 } |
| 105 | 99 |
| 106 } // namespace | 100 } // namespace |
| OLD | NEW |