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

Unified Diff: util/win/process_info_test.cc

Issue 1339813002: win: Fix ProcessInfo test when running on x86 host OS (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@fix-pipe-connection-leak
Patch Set: switch to IsWow64Process 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: util/win/process_info_test.cc
diff --git a/util/win/process_info_test.cc b/util/win/process_info_test.cc
index 3bc18c723831c4e4c17cfcb7bd36b60095007ad9..3e7a71dc92216af3f9d1b8f6354f3bfd3c1092c8 100644
--- a/util/win/process_info_test.cc
+++ b/util/win/process_info_test.cc
@@ -41,6 +41,20 @@ time_t GetTimestampForModule(HMODULE module) {
return loaded_image->FileHeader->FileHeader.TimeDateStamp;
}
+bool IsProcessWow64(HANDLE process_handle) {
+ static decltype(IsWow64Process)* is_wow64_process =
+ reinterpret_cast<decltype(IsWow64Process)*>(
+ GetProcAddress(LoadLibrary(L"kernel32.dll"), "IsWow64Process"));
+ if (!is_wow64_process)
+ return false;
+ BOOL is_wow64;
+ if (!is_wow64_process(process_handle, &is_wow64)) {
+ PLOG(ERROR) << "IsWow64Process";
+ return false;
+ }
+ return is_wow64;
+}
+
TEST(ProcessInfo, Self) {
ProcessInfo process_info;
ASSERT_TRUE(process_info.Initialize(GetCurrentProcess()));
@@ -52,8 +66,10 @@ TEST(ProcessInfo, Self) {
EXPECT_FALSE(process_info.IsWow64());
#else
EXPECT_FALSE(process_info.Is64Bit());
- // Assume we won't be running these tests on a 32 bit host OS.
- EXPECT_TRUE(process_info.IsWow64());
+ if (IsProcessWow64(GetCurrentProcess()))
+ EXPECT_TRUE(process_info.IsWow64());
+ else
+ EXPECT_FALSE(process_info.IsWow64());
#endif
std::wstring command_line;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698