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 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
260 | 260 |
261 FARPROC address1 = pe.GetProcAddress("RegEnumKeyExW"); | 261 FARPROC address1 = pe.GetProcAddress("RegEnumKeyExW"); |
262 FARPROC address2 = pe.GetProcAddress(reinterpret_cast<char*>(ordinal)); | 262 FARPROC address2 = pe.GetProcAddress(reinterpret_cast<char*>(ordinal)); |
263 EXPECT_TRUE(address1 != NULL); | 263 EXPECT_TRUE(address1 != NULL); |
264 EXPECT_TRUE(address2 != NULL); | 264 EXPECT_TRUE(address2 != NULL); |
265 EXPECT_TRUE(address1 == address2); | 265 EXPECT_TRUE(address1 == address2); |
266 | 266 |
267 FreeLibrary(module); | 267 FreeLibrary(module); |
268 } | 268 } |
269 | 269 |
| 270 // Test that we can get debug id out of a module. |
| 271 TEST(PEImageTest, GetDebugId) { |
| 272 HMODULE module = LoadLibrary(L"advapi32.dll"); |
| 273 ASSERT_TRUE(NULL != module); |
| 274 |
| 275 PEImage pe(module); |
| 276 GUID guid = {0}; |
| 277 DWORD age = 0; |
| 278 EXPECT_TRUE(pe.GetDebugId(&guid, &age)); |
| 279 |
| 280 GUID empty_guid = {0}; |
| 281 EXPECT_TRUE(!IsEqualGUID(empty_guid, guid)); |
| 282 EXPECT_NE(0U, age); |
| 283 FreeLibrary(module); |
| 284 } |
| 285 |
270 } // namespace win | 286 } // namespace win |
271 } // namespace base | 287 } // namespace base |
OLD | NEW |