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

Unified Diff: chrome/browser/extensions/api/sync_file_system/sync_file_system_apitest.cc

Issue 118043003: Fix app_shell shutdown crash due to BrowserContextKeyedServices (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: ScopedFactoryForTest (shutdown_crash) Created 6 years, 11 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/extensions/api/sync_file_system/sync_file_system_apitest.cc
diff --git a/chrome/browser/extensions/api/sync_file_system/sync_file_system_apitest.cc b/chrome/browser/extensions/api/sync_file_system/sync_file_system_apitest.cc
index e306afeec1db07250fcaa0aa91b2a29476f42f76..77633380452637ddbd4ede0dd30e024e4d178969 100644
--- a/chrome/browser/extensions/api/sync_file_system/sync_file_system_apitest.cc
+++ b/chrome/browser/extensions/api/sync_file_system/sync_file_system_apitest.cc
@@ -37,13 +37,10 @@ namespace {
class SyncFileSystemApiTest : public ExtensionApiTest {
public:
- SyncFileSystemApiTest() {}
+ SyncFileSystemApiTest()
+ : mock_remote_service_(NULL), real_default_quota_(0) {}
virtual void SetUpInProcessBrowserTestFixture() OVERRIDE {
- mock_remote_service_ = new ::testing::NiceMock<MockRemoteFileSyncService>;
- SyncFileSystemServiceFactory::GetInstance()->set_mock_remote_file_service(
- scoped_ptr<RemoteFileSyncService>(mock_remote_service_));
-
ExtensionApiTest::SetUpInProcessBrowserTestFixture();
// TODO(calvinlo): Update test code after default quota is made const
// (http://crbug.com/155488).
@@ -56,6 +53,16 @@ class SyncFileSystemApiTest : public ExtensionApiTest {
ExtensionApiTest::TearDownInProcessBrowserTestFixture();
}
+ virtual void SetUpOnMainThread() OVERRIDE {
+ // Must happen after the browser process is created because instantiating
+ // the factory will instantiate ExtensionSystemFactory which depends on
+ // ExtensionsBrowserClient setup in BrowserProcessImpl.
+ mock_remote_service_ = new ::testing::NiceMock<MockRemoteFileSyncService>;
+ SyncFileSystemServiceFactory::GetInstance()->set_mock_remote_file_service(
+ scoped_ptr<RemoteFileSyncService>(mock_remote_service_));
+ ExtensionApiTest::SetUpOnMainThread();
+ }
+
::testing::NiceMock<MockRemoteFileSyncService>* mock_remote_service() {
return mock_remote_service_;
}

Powered by Google App Engine
This is Rietveld 408576698