Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(139)

Side by Side Diff: chrome_elf/elf_imports_unittest.cc

Issue 1513043002: clang/win: Let remaining chromium_code targets build with -Wextra. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 #endif 84 #endif
85 #if defined(ADDRESS_SANITIZER) && defined(COMPONENT_BUILD) 85 #if defined(ADDRESS_SANITIZER) && defined(COMPONENT_BUILD)
86 "clang_rt.asan_dynamic-i386.dll", 86 "clang_rt.asan_dynamic-i386.dll",
87 #endif 87 #endif
88 "ADVAPI32.dll" 88 "ADVAPI32.dll"
89 }; 89 };
90 90
91 // Make sure all of ELF's imports are in the valid imports list. 91 // Make sure all of ELF's imports are in the valid imports list.
92 for (const std::string& import : elf_imports) { 92 for (const std::string& import : elf_imports) {
93 bool match = false; 93 bool match = false;
94 for (int i = 0; i < arraysize(kValidFilePatterns); ++i) { 94 for (const char* kValidFilePattern : kValidFilePatterns) {
95 if (base::MatchPattern(import, kValidFilePatterns[i])) { 95 if (base::MatchPattern(import, kValidFilePattern)) {
96 match = true; 96 match = true;
97 break; 97 break;
98 } 98 }
99 } 99 }
100 ASSERT_TRUE(match) << "Illegal import in chrome_elf.dll: " << import; 100 ASSERT_TRUE(match) << "Illegal import in chrome_elf.dll: " << import;
101 } 101 }
102 } 102 }
103 #endif // NDEBUG 103 #endif // NDEBUG
104 104
105 TEST_F(ELFImportsTest, ChromeExeSanityCheck) { 105 TEST_F(ELFImportsTest, ChromeExeSanityCheck) {
106 std::vector<std::string> exe_imports; 106 std::vector<std::string> exe_imports;
107 107
108 base::FilePath exe; 108 base::FilePath exe;
109 ASSERT_TRUE(PathService::Get(base::DIR_EXE, &exe)); 109 ASSERT_TRUE(PathService::Get(base::DIR_EXE, &exe));
110 exe = exe.Append(L"chrome.exe"); 110 exe = exe.Append(L"chrome.exe");
111 GetImports(exe, &exe_imports); 111 GetImports(exe, &exe_imports);
112 112
113 // Check that chrome.exe has imports. 113 // Check that chrome.exe has imports.
114 ASSERT_LT(0u, exe_imports.size()) << "Ensure the chrome_elf_unittests " 114 ASSERT_LT(0u, exe_imports.size()) << "Ensure the chrome_elf_unittests "
115 "target was built, instead of chrome_elf_unittests.exe"; 115 "target was built, instead of chrome_elf_unittests.exe";
116 116
117 // Chrome.exe's first import must be ELF. 117 // Chrome.exe's first import must be ELF.
118 EXPECT_EQ("chrome_elf.dll", exe_imports[0]) << 118 EXPECT_EQ("chrome_elf.dll", exe_imports[0]) <<
119 "Illegal import order in chrome.exe (ensure the chrome_elf_unittest " 119 "Illegal import order in chrome.exe (ensure the chrome_elf_unittest "
120 "target was built, instead of just chrome_elf_unittests.exe)"; 120 "target was built, instead of just chrome_elf_unittests.exe)";
121 } 121 }
122 122
123 } // namespace 123 } // namespace
OLDNEW
« no previous file with comments | « chrome_elf/blacklist/test/blacklist_test.cc ('k') | cloud_print/virtual_driver/win/port_monitor/port_monitor_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698