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

Unified Diff: chrome/browser/sync_file_system/local/local_file_sync_service_unittest.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_unittest.cc
diff --git a/chrome/browser/sync_file_system/local/local_file_sync_service_unittest.cc b/chrome/browser/sync_file_system/local/local_file_sync_service_unittest.cc
index 79e91e07c979ddddf679caeb6138051a5588681e..b6c82075134ae81fe61ce2be26b254651e1a7fe6 100644
--- a/chrome/browser/sync_file_system/local/local_file_sync_service_unittest.cc
+++ b/chrome/browser/sync_file_system/local/local_file_sync_service_unittest.cc
@@ -31,6 +31,8 @@
#include "content/public/test/test_utils.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/leveldatabase/src/helpers/memenv/memenv.h"
+#include "third_party/leveldatabase/src/include/leveldb/env.h"
#include "webkit/browser/fileapi/file_system_context.h"
using content::BrowserThread;
@@ -109,13 +111,16 @@ class LocalFileSyncServiceTest
virtual void SetUp() OVERRIDE {
ASSERT_TRUE(temp_dir_.CreateUniqueTempDir());
+ in_memory_env_.reset(leveldb::NewMemEnv(leveldb::Env::Default()));
file_system_.reset(new CannedSyncableFileSystem(
GURL(kOrigin),
+ in_memory_env_.get(),
BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO),
BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE)));
- local_service_.reset(new LocalFileSyncService(&profile_));
+ local_service_ = LocalFileSyncService::CreateForTesting(
+ &profile_, in_memory_env_.get());
file_system_->SetUp();
@@ -192,9 +197,9 @@ class LocalFileSyncServiceTest
content::TestBrowserThreadBundle thread_bundle_;
ScopedEnableSyncFSDirectoryOperation enable_directory_operation_;
- TestingProfile profile_;
-
base::ScopedTempDir temp_dir_;
+ scoped_ptr<leveldb::Env> in_memory_env_;
+ TestingProfile profile_;
scoped_ptr<CannedSyncableFileSystem> file_system_;
scoped_ptr<LocalFileSyncService> local_service_;
@@ -294,6 +299,7 @@ TEST_F(LocalFileSyncServiceTest, MAYBE_LocalChangeObserverMultipleContexts) {
const char kOrigin2[] = "http://foo";
CannedSyncableFileSystem file_system2(
GURL(kOrigin2),
+ in_memory_env_.get(),
BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO),
BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE));
file_system2.SetUp();

Powered by Google App Engine
This is Rietveld 408576698