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_; |
} |