Index: chrome/browser/lifetime/application_lifetime.cc |
diff --git a/chrome/browser/lifetime/application_lifetime.cc b/chrome/browser/lifetime/application_lifetime.cc |
index ac9ff01f43aa4ea60b611be98da1c58cd94896a6..0e87a2cf5f989f15ce87af7c4c2f9685d6c8b251 100644 |
--- a/chrome/browser/lifetime/application_lifetime.cc |
+++ b/chrome/browser/lifetime/application_lifetime.cc |
@@ -82,6 +82,7 @@ bool AreAllBrowsersCloseable() { |
#endif // !defined(OS_ANDROID) |
int g_keep_alive_count = 0; |
+bool g_disable_shutdown_for_testing = false; |
#if defined(OS_CHROMEOS) |
// Whether chrome should send stop request to a session manager. |
@@ -332,11 +333,11 @@ void DecrementKeepAliveCount() { |
if (!WillKeepAlive()) { |
g_browser_process->ReleaseModule(); |
// If there are no browsers open and we aren't already shutting down, |
- // initiate a shutdown. Also skips shutdown if this is a unit test |
- // (MessageLoop::current() == null). |
+ // initiate a shutdown. Also skips shutdown if this is a unit test. |
+ // (MessageLoop::current() == null or explicitly disabled). |
if (chrome::GetTotalBrowserCount() == 0 && |
- !browser_shutdown::IsTryingToQuit() && |
- base::MessageLoop::current()) { |
+ !browser_shutdown::IsTryingToQuit() && base::MessageLoop::current() && |
+ !g_disable_shutdown_for_testing) { |
CloseAllBrowsers(); |
} |
} |
@@ -422,4 +423,8 @@ bool ShouldStartShutdown(Browser* browser) { |
return true; |
} |
+void DisableShutdownForTesting(bool disable_shutdown_for_testing) { |
+ g_disable_shutdown_for_testing = disable_shutdown_for_testing; |
Andrew T Wilson (Slow)
2015/04/27 09:48:26
Should setting this to false also initiate a shutd
Sami
2015/04/27 11:31:40
That's a good thought, but unfortunately in Backgr
|
+} |
+ |
} // namespace chrome |