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

Unified Diff: snapshot/win/pe_image_reader_test.cc

Issue 1336823002: win x86: Grab bag of restructuring to get tests working on x86-on-x86 (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@master
Patch Set: fixes2 Created 5 years, 3 months 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 side-by-side diff with in-line comments
Download patch
Index: snapshot/win/pe_image_reader_test.cc
diff --git a/snapshot/win/pe_image_reader_test.cc b/snapshot/win/pe_image_reader_test.cc
index 8da329e47d7bf047df5cdb3ce104fd508e6dcea4..4a3bbd2205a344926911a9d99c8a78dd768c0026 100644
--- a/snapshot/win/pe_image_reader_test.cc
+++ b/snapshot/win/pe_image_reader_test.cc
@@ -14,6 +14,7 @@
#include "snapshot/win/pe_image_reader.h"
+#define PSAPI_VERSION 1
#include <psapi.h>
#include "gtest/gtest.h"
@@ -25,6 +26,17 @@ namespace crashpad {
namespace test {
namespace {
+BOOL CrashpadGetModuleInformation(HANDLE process,
+ HMODULE module,
+ MODULEINFO* module_info,
+ DWORD cb) {
+ static decltype(GetModuleInformation)* get_module_information =
+ reinterpret_cast<decltype(GetModuleInformation)*>(
+ GetProcAddress(LoadLibrary(L"psapi.dll"), "GetModuleInformation"));
+ DCHECK(get_module_information);
+ return get_module_information(process, module, module_info, cb);
+}
+
TEST(PEImageReader, DebugDirectory) {
PEImageReader pe_image_reader;
ProcessReaderWin process_reader;
@@ -32,7 +44,7 @@ TEST(PEImageReader, DebugDirectory) {
ProcessSuspensionState::kRunning));
HMODULE self = reinterpret_cast<HMODULE>(&__ImageBase);
MODULEINFO module_info;
- ASSERT_TRUE(GetModuleInformation(
+ ASSERT_TRUE(CrashpadGetModuleInformation(
GetCurrentProcess(), self, &module_info, sizeof(module_info)));
EXPECT_EQ(self, module_info.lpBaseOfDll);
EXPECT_TRUE(pe_image_reader.Initialize(&process_reader,

Powered by Google App Engine
This is Rietveld 408576698