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

Unified Diff: sync/internal_api/test/fake_sync_manager.cc

Issue 11360259: Sync: Add DeviceInfo's ChangeProcessor (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 1 month 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: sync/internal_api/test/fake_sync_manager.cc
diff --git a/sync/internal_api/test/fake_sync_manager.cc b/sync/internal_api/test/fake_sync_manager.cc
index f90bbd738f68e45ae6679602ceecb0195f3ecc7d..6f4a3c875fd66c7fa5584a9b20bd99c7c3cf9879 100644
--- a/sync/internal_api/test/fake_sync_manager.cc
+++ b/sync/internal_api/test/fake_sync_manager.cc
@@ -20,6 +20,7 @@
#include "sync/notifier/invalidator_state.h"
#include "sync/notifier/object_id_invalidation_map.h"
#include "sync/test/fake_sync_encryption_handler.h"
+#include "sync/syncable/directory.h"
namespace syncer {
@@ -96,7 +97,6 @@ void FakeSyncManager::Init(
const std::string& sync_server_and_path,
int sync_server_port,
bool use_ssl,
- const scoped_refptr<base::TaskRunner>& blocking_task_runner,
scoped_ptr<HttpPostProviderFactory> post_factory,
const std::vector<ModelSafeWorker*>& workers,
ExtensionsActivityMonitor* extensions_activity_monitor,
@@ -112,6 +112,14 @@ void FakeSyncManager::Init(
report_unrecoverable_error_function) {
sync_task_runner_ = base::ThreadTaskRunnerHandle::Get();
PurgePartiallySyncedTypes();
+
+ test_user_share_.SetUp();
+ UserShare* share = test_user_share_.user_share();
+ for (ModelTypeSet::Iterator it = initial_sync_ended_types_.First();
+ it.Good(); it.Inc()) {
+ TestUserShare::CreateRoot(it.Get(), share);
+ }
+
FOR_EACH_OBSERVER(SyncManager::Observer, observers_,
OnInitializationComplete(
WeakHandle<JsBackend>(),
@@ -191,6 +199,16 @@ void FakeSyncManager::ConfigureSyncer(
<< ModelTypeSetToString(success_types) << ". Cleaning: "
<< ModelTypeSetToString(disabled_types);
+ // Update our fake directory by clearing and fake-downloading as necessary.
+ UserShare* share = GetUserShare();
+ share->directory->PurgeEntriesWithTypeIn(disabled_types);
+ for (ModelTypeSet::Iterator it = success_types.First(); it.Good(); it.Inc()) {
+ // We must be careful to not create the same root node twice.
+ if (!initial_sync_ended_types_.Has(it.Get())) {
+ TestUserShare::CreateRoot(it.Get(), share);
+ }
+ }
+
// Simulate cleaning up disabled types.
// TODO(sync): consider only cleaning those types that were recently disabled,
// if this isn't the first cleanup, which more accurately reflects the
@@ -233,10 +251,15 @@ void FakeSyncManager::StopSyncingForShutdown(const base::Closure& callback) {
void FakeSyncManager::ShutdownOnSyncThread() {
DCHECK(sync_task_runner_->RunsTasksOnCurrentThread());
+ test_user_share_.TearDown();
}
UserShare* FakeSyncManager::GetUserShare() {
- return NULL;
+ return test_user_share_.user_share();
+}
+
+const std::string FakeSyncManager::cache_guid() {
+ return test_user_share_.user_share()->directory->cache_guid();
}
bool FakeSyncManager::ReceivedExperiment(Experiments* experiments) {

Powered by Google App Engine
This is Rietveld 408576698