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

Unified Diff: chrome/browser/sync_file_system/drive_backend_v1/drive_file_sync_service_sync_unittest.cc

Issue 218903005: Make push messaging not create InvalidationService for login and guest (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Make code resilient against tests that do not create the Default profile first. Created 6 years, 9 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/sync_file_system/drive_backend_v1/drive_file_sync_service_sync_unittest.cc
diff --git a/chrome/browser/sync_file_system/drive_backend_v1/drive_file_sync_service_sync_unittest.cc b/chrome/browser/sync_file_system/drive_backend_v1/drive_file_sync_service_sync_unittest.cc
index 54076117e011b70a56310e991137cc62a0c28295..8dc792038205c85398be9ebdd2625055f7eb2426 100644
--- a/chrome/browser/sync_file_system/drive_backend_v1/drive_file_sync_service_sync_unittest.cc
+++ b/chrome/browser/sync_file_system/drive_backend_v1/drive_file_sync_service_sync_unittest.cc
@@ -24,7 +24,9 @@
#include "chrome/browser/sync_file_system/local/sync_file_system_backend.h"
#include "chrome/browser/sync_file_system/sync_file_system_test_util.h"
#include "chrome/browser/sync_file_system/syncable_file_system_util.h"
+#include "chrome/test/base/testing_browser_process.h"
#include "chrome/test/base/testing_profile.h"
+#include "chrome/test/base/testing_profile_manager.h"
#include "content/public/test/test_browser_thread.h"
#include "content/public/test/test_browser_thread_bundle.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -41,6 +43,10 @@ using google_apis::ResourceEntry;
namespace sync_file_system {
+namespace {
+const char kTestProfileName[] = "test-profile";
+}
+
using drive_backend::APIUtil;
using drive_backend::APIUtilInterface;
using drive_backend::FakeDriveServiceHelper;
@@ -48,7 +54,8 @@ using drive_backend::FakeDriveServiceHelper;
class DriveFileSyncServiceSyncTest : public testing::Test {
public:
DriveFileSyncServiceSyncTest()
- : thread_bundle_(content::TestBrowserThreadBundle::IO_MAINLOOP) {}
+ : thread_bundle_(content::TestBrowserThreadBundle::IO_MAINLOOP),
+ profile_manager_(TestingBrowserProcess::GetGlobal()) {}
virtual ~DriveFileSyncServiceSyncTest() {
}
@@ -57,9 +64,13 @@ class DriveFileSyncServiceSyncTest : public testing::Test {
// TODO(tzik): Set up TestExtensionSystem to support simulated relaunch.
in_memory_env_.reset(leveldb::NewMemEnv(leveldb::Env::Default()));
+ ASSERT_TRUE(profile_manager_.SetUp());
+ TestingProfile* profile =
+ profile_manager_.CreateTestingProfile(kTestProfileName);
+
RegisterSyncableFileSystem();
local_sync_service_ = LocalFileSyncService::CreateForTesting(
- &profile_, in_memory_env_.get());
+ profile, in_memory_env_.get());
fake_drive_service_ = new drive::FakeDriveService();
fake_drive_service_->Initialize("test_user@gmail.com");
@@ -91,7 +102,7 @@ class DriveFileSyncServiceSyncTest : public testing::Test {
scoped_ptr<drive::DriveUploaderInterface>(drive_uploader_)));
remote_sync_service_ = DriveFileSyncService::CreateForTesting(
- &profile_,
+ profile,
fake_drive_helper_->base_dir_path(),
api_util.PassAs<APIUtilInterface>(),
metadata_store.Pass());
@@ -363,7 +374,7 @@ class DriveFileSyncServiceSyncTest : public testing::Test {
content::TestBrowserThreadBundle thread_bundle_;
scoped_ptr<leveldb::Env> in_memory_env_;
- TestingProfile profile_;
+ TestingProfileManager profile_manager_;
drive::FakeDriveService* fake_drive_service_;
drive::DriveUploader* drive_uploader_;

Powered by Google App Engine
This is Rietveld 408576698