OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 // This file contains unit tests for PEImage. | 5 // This file contains unit tests for PEImage. |
6 | 6 |
7 #include "testing/gtest/include/gtest/gtest.h" | 7 #include "testing/gtest/include/gtest/gtest.h" |
8 #include "base/win/pe_image.h" | 8 #include "base/win/pe_image.h" |
9 #include "base/win/windows_version.h" | 9 #include "base/win/windows_version.h" |
10 | 10 |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 const int win7_delay_dlls = 7; | 114 const int win7_delay_dlls = 7; |
115 const int win7_exports = 806; | 115 const int win7_exports = 806; |
116 const int win7_imports = 568; | 116 const int win7_imports = 568; |
117 const int win7_delay_imports = 71; | 117 const int win7_delay_imports = 71; |
118 const int win7_relocs = 7812; | 118 const int win7_relocs = 7812; |
119 const int win8_delay_dlls = 9; | 119 const int win8_delay_dlls = 9; |
120 const int win8_exports = 806; | 120 const int win8_exports = 806; |
121 const int win8_imports = 568; | 121 const int win8_imports = 568; |
122 const int win8_delay_imports = 113; | 122 const int win8_delay_imports = 113; |
123 const int win8_relocs = 9478; | 123 const int win8_relocs = 9478; |
| 124 int win8_sections = 4; |
| 125 int win8_import_dlls = 17; |
| 126 |
| 127 base::win::OSInfo* os_info = base::win::OSInfo::GetInstance(); |
| 128 if (os_info->architecture() == base::win::OSInfo::X86_ARCHITECTURE) { |
| 129 win8_sections = 5; |
| 130 win8_import_dlls = 19; |
| 131 } |
124 | 132 |
125 // Contains the expected value, for each enumerated property (Value), and the | 133 // Contains the expected value, for each enumerated property (Value), and the |
126 // OS version: [Value][os_version] | 134 // OS version: [Value][os_version] |
127 const int expected[][5] = { | 135 const int expected[][5] = { |
128 {4, 4, 4, 4, 5}, | 136 {4, 4, 4, 4, win8_sections}, |
129 {3, 3, 3, 13, 19}, | 137 {3, 3, 3, 13, win8_import_dlls}, |
130 {w2k_delay_dlls, xp_delay_dlls, vista_delay_dlls, win7_delay_dlls, | 138 {w2k_delay_dlls, xp_delay_dlls, vista_delay_dlls, win7_delay_dlls, |
131 win8_delay_dlls}, | 139 win8_delay_dlls}, |
132 {w2k_exports, xp_exports, vista_exports, win7_exports, win8_exports}, | 140 {w2k_exports, xp_exports, vista_exports, win7_exports, win8_exports}, |
133 {w2k_imports, xp_imports, vista_imports, win7_imports, win8_imports}, | 141 {w2k_imports, xp_imports, vista_imports, win7_imports, win8_imports}, |
134 {w2k_delay_imports, xp_delay_imports, | 142 {w2k_delay_imports, xp_delay_imports, |
135 vista_delay_imports, win7_delay_imports, win8_delay_imports}, | 143 vista_delay_imports, win7_delay_imports, win8_delay_imports}, |
136 {w2k_relocs, xp_relocs, vista_relocs, win7_relocs, win8_relocs} | 144 {w2k_relocs, xp_relocs, vista_relocs, win7_relocs, win8_relocs} |
137 }; | 145 }; |
138 | 146 |
139 if (value > relocs) | 147 if (value > relocs) |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
218 FARPROC address2 = pe.GetProcAddress(reinterpret_cast<char*>(ordinal)); | 226 FARPROC address2 = pe.GetProcAddress(reinterpret_cast<char*>(ordinal)); |
219 EXPECT_TRUE(address1 != NULL); | 227 EXPECT_TRUE(address1 != NULL); |
220 EXPECT_TRUE(address2 != NULL); | 228 EXPECT_TRUE(address2 != NULL); |
221 EXPECT_TRUE(address1 == address2); | 229 EXPECT_TRUE(address1 == address2); |
222 | 230 |
223 FreeLibrary(module); | 231 FreeLibrary(module); |
224 } | 232 } |
225 | 233 |
226 } // namespace win | 234 } // namespace win |
227 } // namespace base | 235 } // namespace base |
OLD | NEW |