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

Unified Diff: chrome/browser/lifetime/application_lifetime.cc

Issue 1086733002: Ensure tests have an active task runner (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add loop to DataReductionProxyConfiguratorTest. Created 5 years, 8 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/lifetime/application_lifetime.h ('k') | chrome/browser/metrics/thread_watcher_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « chrome/browser/lifetime/application_lifetime.h ('k') | chrome/browser/metrics/thread_watcher_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698