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

Unified Diff: chrome/test/base/interactive_test_utils_win.cc

Issue 549713004: Add more logging to ShowAndFocusNativeWindow. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 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: chrome/test/base/interactive_test_utils_win.cc
diff --git a/chrome/test/base/interactive_test_utils_win.cc b/chrome/test/base/interactive_test_utils_win.cc
index 232a85e62cb572f27cc6fcf5306c0061e51d72dc..fd3ec7b22dcb8d2f1766531aa080c78c14bc3267 100644
--- a/chrome/test/base/interactive_test_utils_win.cc
+++ b/chrome/test/base/interactive_test_utils_win.cc
@@ -4,6 +4,8 @@
#include "chrome/test/base/interactive_test_utils.h"
+#include <Psapi.h>
+
#include "base/files/file_path.h"
#include "base/logging.h"
#include "base/path_service.h"
@@ -50,10 +52,24 @@ bool ShowAndFocusNativeWindow(gfx::NativeWindow window) {
if (foreground_window == hwnd)
return true;
- wchar_t window_title[256];
- GetWindowText(foreground_window, window_title, arraysize(window_title));
- LOG(ERROR) << "ShowAndFocusNativeWindow failed. foreground window text: " <<
- window_title;
+ wchar_t window_title[256];
+ std::wstring path_str;
+ if (foreground_window) {
+ DWORD process_id = 0;
+ GetWindowThreadProcessId(foreground_window, &process_id);
+ HANDLE process_handle = OpenProcess(
+ PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, FALSE, process_id);
+ if (process_handle) {
+ wchar_t path[MAX_PATH];
+ if (GetModuleFileNameEx(process_handle, NULL, path, MAX_PATH))
+ path_str = path;
+ CloseHandle(process_handle);
+ }
+ }
+ GetWindowText(foreground_window, window_title, arraysize(window_title));
+ LOG(ERROR) << "ShowAndFocusNativeWindow failed. foreground window: "
+ << foreground_window << ", title: " << window_title << ", path: "
+ << path_str;
return false;
}
« 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