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

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: Now tests the user interaction cases. 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
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..aa71917afd2d2c8e630291f99597777a1eaf6de7 100644
--- a/chrome/browser/process_singleton_win.cc
+++ b/chrome/browser/process_singleton_win.cc
@@ -195,6 +195,15 @@ 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.
@@ -233,7 +242,9 @@ ProcessSingleton::ProcessSingleton(
const NotificationCallback& notification_callback)
: notification_callback_(notification_callback),
is_virtualized_(false), lock_file_(INVALID_HANDLE_VALUE),
- user_data_dir_(user_data_dir) {
+ user_data_dir_(user_data_dir),
+ display_should_kill_messagebox_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 && !display_should_kill_messagebox_callback_.Run()) {
// The user denied. Quit silently.
return PROCESS_NOTIFIED;
}
@@ -437,3 +443,8 @@ bool ProcessSingleton::Create() {
void ProcessSingleton::Cleanup() {
}
+
+void ProcessSingleton::OverrideKillMessageBoxCallbackForTesting(
erikwright (departed) 2015/03/10 19:22:49 extra space after void
Sigurður Ásgeirsson 2015/03/10 19:48:15 Done.
+ const DisplayShouldKillMessageBoxCallback& display_dialog_callback) {
+ display_should_kill_messagebox_callback_ = display_dialog_callback;
+}

Powered by Google App Engine
This is Rietveld 408576698