| 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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 // In release builds, the offending imports are all stripped since this | 55 // In release builds, the offending imports are all stripped since this |
| 56 // depends on a relatively small portion of base. In GYP, this works in debug | 56 // depends on a relatively small portion of base. In GYP, this works in debug |
| 57 // builds as well because static libraries are used for the sandbox and base | 57 // builds as well because static libraries are used for the sandbox and base |
| 58 // targets and the files that use e.g. user32.dll happen to not get brought | 58 // targets and the files that use e.g. user32.dll happen to not get brought |
| 59 // into the build in the first place (due to the way static libraries are | 59 // into the build in the first place (due to the way static libraries are |
| 60 // linked where only the required .o files are included). But we don't bother | 60 // linked where only the required .o files are included). But we don't bother |
| 61 // differentiating GYP and GN builds for this purpose. | 61 // differentiating GYP and GN builds for this purpose. |
| 62 // | 62 // |
| 63 // If you break this test, you may have changed base or the Windows sandbox | 63 // If you break this test, you may have changed base or the Windows sandbox |
| 64 // such that more system imports are required to link. | 64 // such that more system imports are required to link. |
| 65 #ifdef NDEBUG | 65 #if defined(NDEBUG) && !defined(COMPONENT_BUILD) |
| 66 TEST_F(ELFImportsTest, ChromeElfSanityCheck) { | 66 TEST_F(ELFImportsTest, ChromeElfSanityCheck) { |
| 67 base::FilePath dll; | 67 base::FilePath dll; |
| 68 ASSERT_TRUE(PathService::Get(base::DIR_EXE, &dll)); | 68 ASSERT_TRUE(PathService::Get(base::DIR_EXE, &dll)); |
| 69 dll = dll.Append(L"chrome_elf.dll"); | 69 dll = dll.Append(L"chrome_elf.dll"); |
| 70 | 70 |
| 71 std::vector<std::string> elf_imports; | 71 std::vector<std::string> elf_imports; |
| 72 GetImports(dll, &elf_imports); | 72 GetImports(dll, &elf_imports); |
| 73 | 73 |
| 74 // Check that ELF has imports. | 74 // Check that ELF has imports. |
| 75 ASSERT_LT(0u, elf_imports.size()) << "Ensure the chrome_elf_unittests " | 75 ASSERT_LT(0u, elf_imports.size()) << "Ensure the chrome_elf_unittests " |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 ASSERT_LT(0u, exe_imports.size()) << "Ensure the chrome_elf_unittests " | 121 ASSERT_LT(0u, exe_imports.size()) << "Ensure the chrome_elf_unittests " |
| 122 "target was built, instead of chrome_elf_unittests.exe"; | 122 "target was built, instead of chrome_elf_unittests.exe"; |
| 123 | 123 |
| 124 // Chrome.exe's first import must be ELF. | 124 // Chrome.exe's first import must be ELF. |
| 125 EXPECT_EQ("chrome_elf.dll", exe_imports[0]) << | 125 EXPECT_EQ("chrome_elf.dll", exe_imports[0]) << |
| 126 "Illegal import order in chrome.exe (ensure the chrome_elf_unittest " | 126 "Illegal import order in chrome.exe (ensure the chrome_elf_unittest " |
| 127 "target was built, instead of just chrome_elf_unittests.exe)"; | 127 "target was built, instead of just chrome_elf_unittests.exe)"; |
| 128 } | 128 } |
| 129 | 129 |
| 130 } // namespace | 130 } // namespace |
| OLD | NEW |