| 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;
|
| }
|
|
|
|
|