Index: chrome/test/base/testing_browser_process.cc |
diff --git a/chrome/test/base/testing_browser_process.cc b/chrome/test/base/testing_browser_process.cc |
index 4f2cd474d7245346e43f11049370bd633dae2ca1..b01fb815e1f1ca0dacdadaf6c22b661b4760ed23 100644 |
--- a/chrome/test/base/testing_browser_process.cc |
+++ b/chrome/test/base/testing_browser_process.cc |
@@ -10,6 +10,7 @@ |
#include "build/build_config.h" |
#include "chrome/browser/browser_process.h" |
#include "chrome/browser/browser_process_impl.h" |
+#include "chrome/browser/lifetime/application_lifetime.h" |
#include "chrome/browser/notifications/notification_ui_manager.h" |
#include "chrome/browser/printing/print_job_manager.h" |
#include "chrome/browser/profiles/profile_manager.h" |
@@ -62,7 +63,7 @@ void TestingBrowserProcess::DeleteInstance() { |
TestingBrowserProcess::TestingBrowserProcess() |
: notification_service_(content::NotificationService::Create()), |
- module_ref_count_(0), |
+ is_pinned_(false), |
app_locale_("en"), |
local_state_(nullptr), |
io_thread_(nullptr), |
@@ -234,13 +235,18 @@ void TestingBrowserProcess::CreateDevToolsHttpProtocolHandler( |
void TestingBrowserProcess::CreateDevToolsAutoOpener() { |
} |
-unsigned int TestingBrowserProcess::AddRefModule() { |
- return ++module_ref_count_; |
+void TestingBrowserProcess::Pin() { |
+ is_pinned_ = true; |
} |
-unsigned int TestingBrowserProcess::ReleaseModule() { |
- DCHECK_GT(module_ref_count_, 0U); |
- return --module_ref_count_; |
+void TestingBrowserProcess::Unpin() { |
+ is_pinned_ = false; |
+ |
+#if !defined(OS_ANDROID) |
+ // Don't allow the browser to be closed because the shutdown procedure will |
+ // attempt to access objects that we haven't created (e.g., MessageCenter). |
+ chrome::DisableShutdownForTesting(true); |
+#endif // !defined(OS_ANDROID) |
} |
bool TestingBrowserProcess::IsShuttingDown() { |