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

Unified Diff: chrome/browser/sync_file_system/local/local_file_sync_service.cc

Issue 145693005: [FileAPI] Replace default leveldb::Env with leveldb::MemEnv in tests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase 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/sync_file_system/local/local_file_sync_service.cc
diff --git a/chrome/browser/sync_file_system/local/local_file_sync_service.cc b/chrome/browser/sync_file_system/local/local_file_sync_service.cc
index 8666fb3f43a4763f12dcb805168877b73fa98326..51c908a873537ec75f52cfa7f2d8edce786a0209 100644
--- a/chrome/browser/sync_file_system/local/local_file_sync_service.cc
+++ b/chrome/browser/sync_file_system/local/local_file_sync_service.cc
@@ -96,16 +96,15 @@ void LocalFileSyncService::OriginChangeMap::SetOriginEnabled(
// LocalFileSyncService -------------------------------------------------------
-LocalFileSyncService::LocalFileSyncService(Profile* profile)
- : profile_(profile),
- sync_context_(new LocalFileSyncContext(
- profile_->GetPath(),
- BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI).get(),
- BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO)
- .get())),
- local_change_processor_(NULL) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
- sync_context_->AddOriginChangeObserver(this);
+scoped_ptr<LocalFileSyncService> LocalFileSyncService::Create(
+ Profile* profile) {
+ return make_scoped_ptr(new LocalFileSyncService(profile, NULL));
+}
+
+scoped_ptr<LocalFileSyncService> LocalFileSyncService::CreateForTesting(
+ Profile* profile,
+ leveldb::Env* env) {
+ return make_scoped_ptr(new LocalFileSyncService(profile, env));
}
LocalFileSyncService::~LocalFileSyncService() {
@@ -320,6 +319,20 @@ void LocalFileSyncService::SetOriginEnabled(const GURL& origin, bool enabled) {
origin_change_map_.SetOriginEnabled(origin, enabled);
}
+LocalFileSyncService::LocalFileSyncService(Profile* profile,
+ leveldb::Env* env_override)
+ : profile_(profile),
+ sync_context_(new LocalFileSyncContext(
+ profile_->GetPath(),
+ env_override,
+ BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI).get(),
+ BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO)
+ .get())),
+ local_change_processor_(NULL) {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+ sync_context_->AddOriginChangeObserver(this);
+}
+
void LocalFileSyncService::DidInitializeFileSystemContext(
const GURL& app_origin,
fileapi::FileSystemContext* file_system_context,

Powered by Google App Engine
This is Rietveld 408576698