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

Unified Diff: chrome/browser/chromeos/gdata/gdata_cache.cc

Issue 10830181: Implement initialization for GDataCache to use in-memory metadata for tests. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Add 'ForTesting' versions. Created 8 years, 4 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/chromeos/gdata/gdata_cache.cc
diff --git a/chrome/browser/chromeos/gdata/gdata_cache.cc b/chrome/browser/chromeos/gdata/gdata_cache.cc
index 3af5532639fed9812cd2012789168f589f731d85..036e33bc6e0a9cd1c041574ab76984749c5ea4a6 100644
--- a/chrome/browser/chromeos/gdata/gdata_cache.cc
+++ b/chrome/browser/chromeos/gdata/gdata_cache.cc
@@ -697,6 +697,14 @@ void GDataCache::RequestInitializeOnUIThread() {
base::Bind(&GDataCache::Initialize, base::Unretained(this)));
}
+void GDataCache::RequestInitializeOnUIThreadForTesting() {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+
+ blocking_task_runner_->PostTask(
+ FROM_HERE,
+ base::Bind(&GDataCache::InitializeForTesting, base::Unretained(this)));
+}
+
void GDataCache::ForceRescanOnUIThreadForTesting() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
@@ -743,6 +751,15 @@ void GDataCache::Initialize() {
metadata_->Initialize(cache_paths_);
}
+void GDataCache::InitializeForTesting() {
+ AssertOnSequencedWorkerPool();
+
+ InitCachePaths(cache_paths_);
+ metadata_ = GDataCacheMetadata::CreateGDataCacheMetadataForTesting(
+ blocking_task_runner_).Pass();
+ metadata_->Initialize(cache_paths_);
+}
+
void GDataCache::Destroy() {
AssertOnSequencedWorkerPool();
delete this;

Powered by Google App Engine
This is Rietveld 408576698