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

Unified Diff: chrome/browser/process_singleton_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/process_singleton.h ('k') | chrome/browser/process_singleton_win_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/process_singleton_win.cc
diff --git a/chrome/browser/process_singleton_win.cc b/chrome/browser/process_singleton_win.cc
index 82f3d4f5739e2282e196bee5a2de038e8d696df6..bc1240d45a543aac5891d1b731c9fb508100f0a4 100644
--- a/chrome/browser/process_singleton_win.cc
+++ b/chrome/browser/process_singleton_win.cc
@@ -195,6 +195,14 @@ bool ShouldLaunchInWindows8ImmersiveMode(const base::FilePath& user_data_dir) {
return false;
}
+bool DisplayShouldKillMessageBox() {
+ return chrome::ShowMessageBox(
+ NULL, l10n_util::GetStringUTF16(IDS_PRODUCT_NAME),
+ l10n_util::GetStringUTF16(IDS_BROWSER_HUNGBROWSER_MESSAGE),
+ chrome::MESSAGE_BOX_TYPE_QUESTION) !=
+ chrome::MESSAGE_BOX_RESULT_NO;
+}
+
} // namespace
// Microsoft's Softricity virtualization breaks the sandbox processes.
@@ -232,8 +240,11 @@ ProcessSingleton::ProcessSingleton(
const base::FilePath& user_data_dir,
const NotificationCallback& notification_callback)
: notification_callback_(notification_callback),
- is_virtualized_(false), lock_file_(INVALID_HANDLE_VALUE),
- user_data_dir_(user_data_dir) {
+ is_virtualized_(false),
+ lock_file_(INVALID_HANDLE_VALUE),
+ user_data_dir_(user_data_dir),
+ should_kill_remote_process_callback_(
+ base::Bind(&DisplayShouldKillMessageBox)) {
}
ProcessSingleton::~ProcessSingleton() {
@@ -279,12 +290,7 @@ ProcessSingleton::NotifyResult ProcessSingleton::NotifyOtherProcess() {
reinterpret_cast<LPARAM>(&visible_window));
// If there is a visible browser window, ask the user before killing it.
- if (visible_window &&
- chrome::ShowMessageBox(
- NULL,
- l10n_util::GetStringUTF16(IDS_PRODUCT_NAME),
- l10n_util::GetStringUTF16(IDS_BROWSER_HUNGBROWSER_MESSAGE),
- chrome::MESSAGE_BOX_TYPE_QUESTION) == chrome::MESSAGE_BOX_RESULT_NO) {
+ if (visible_window && !should_kill_remote_process_callback_.Run()) {
// The user denied. Quit silently.
return PROCESS_NOTIFIED;
}
@@ -437,3 +443,8 @@ bool ProcessSingleton::Create() {
void ProcessSingleton::Cleanup() {
}
+
+void ProcessSingleton::OverrideShouldKillRemoteProcessCallbackForTesting(
+ const ShouldKillRemoteProcessCallback& display_dialog_callback) {
+ should_kill_remote_process_callback_ = display_dialog_callback;
+}
« no previous file with comments | « chrome/browser/process_singleton.h ('k') | chrome/browser/process_singleton_win_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698