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

Unified Diff: chrome/browser/chrome_process_finder_win.cc

Issue 981223004: Add test for ProcessSingleton hung rendezvous case. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address Scott's remaining comment. Created 5 years, 9 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 | « chrome/browser/chrome_process_finder_win.h ('k') | chrome/browser/process_singleton.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chrome_process_finder_win.cc
diff --git a/chrome/browser/chrome_process_finder_win.cc b/chrome/browser/chrome_process_finder_win.cc
index 0fe88448bf3ee569a5c537c083d398d2e500d7d5..f7c3194c07e44ea665f22616b308a3101bf17aee 100644
--- a/chrome/browser/chrome_process_finder_win.cc
+++ b/chrome/browser/chrome_process_finder_win.cc
@@ -28,7 +28,7 @@
namespace {
-const int kTimeoutInSeconds = 20;
+int timeout_in_milliseconds = 20 * 1000;
// The following is copied from net/base/escape.cc. We don't want to depend on
// net here because this gets compiled into chrome.exe to facilitate
@@ -141,13 +141,9 @@ NotifyChromeResult AttemptToNotifyRunningChrome(HWND remote_window,
cds.cbData = static_cast<DWORD>((to_send.length() + 1) * sizeof(wchar_t));
cds.lpData = const_cast<wchar_t*>(to_send.c_str());
DWORD_PTR result = 0;
- if (::SendMessageTimeout(remote_window,
- WM_COPYDATA,
- NULL,
- reinterpret_cast<LPARAM>(&cds),
- SMTO_ABORTIFHUNG,
- kTimeoutInSeconds * 1000,
- &result)) {
+ if (::SendMessageTimeout(remote_window, WM_COPYDATA, NULL,
+ reinterpret_cast<LPARAM>(&cds), SMTO_ABORTIFHUNG,
+ timeout_in_milliseconds, &result)) {
return result ? NOTIFY_SUCCESS : NOTIFY_FAILED;
}
@@ -159,4 +155,11 @@ NotifyChromeResult AttemptToNotifyRunningChrome(HWND remote_window,
return NOTIFY_WINDOW_HUNG;
}
+base::TimeDelta SetNotificationTimeoutForTesting(base::TimeDelta new_timeout) {
+ base::TimeDelta old_timeout =
+ base::TimeDelta::FromMilliseconds(timeout_in_milliseconds);
+ timeout_in_milliseconds = new_timeout.InMilliseconds();
+ return old_timeout;
+}
+
} // namespace chrome
« no previous file with comments | « chrome/browser/chrome_process_finder_win.h ('k') | chrome/browser/process_singleton.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698