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

Unified Diff: chrome/browser/sync/glue/generic_change_processor_fake.cc

Issue 9395058: [Sync] Remove SyncableServiceAdapter. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Self review Created 8 years, 10 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/glue/generic_change_processor_fake.cc
diff --git a/chrome/browser/sync/glue/generic_change_processor_fake.cc b/chrome/browser/sync/glue/generic_change_processor_fake.cc
new file mode 100644
index 0000000000000000000000000000000000000000..8ec797bd1016d10c567016606abe819c6c262383
--- /dev/null
+++ b/chrome/browser/sync/glue/generic_change_processor_fake.cc
@@ -0,0 +1,73 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/sync/glue/generic_change_processor_fake.h"
+
+#include "base/location.h"
+#include "base/memory/weak_ptr.h"
+#include "chrome/browser/sync/api/syncable_service.h"
+
+namespace browser_sync {
+
+GenericChangeProcessorFake::GenericChangeProcessorFake()
+ : GenericChangeProcessor(NULL, base::WeakPtr<SyncableService>(), NULL) {
+ Reset();
+}
+GenericChangeProcessorFake::~GenericChangeProcessorFake() {}
+
+void GenericChangeProcessorFake::Reset() {
+ process_success_= true;
+ get_sync_data_success_ = true;
+ has_nodes_ = true;
+ has_nodes_success_ = true;
+ crypto_ready_ = true;
+ type_ = syncable::UNSPECIFIED;
+}
+
+void GenericChangeProcessorFake::set_process_success(bool success) {
+ process_success_ = success;
+}
+void GenericChangeProcessorFake::set_get_sync_data_success(bool success) {
+ get_sync_data_success_ = success;
+}
+void GenericChangeProcessorFake::set_has_nodes(bool has_nodes) {
+ has_nodes_ = has_nodes;
+}
+void GenericChangeProcessorFake::set_has_nodes_success(bool success) {
+ has_nodes_success_ = success;
+}
+void GenericChangeProcessorFake::set_crypto_ready(bool crypto_ready) {
+ crypto_ready_ = crypto_ready;
+}
+
+SyncError GenericChangeProcessorFake::ProcessSyncChanges(
+ const tracked_objects::Location& from_here,
+ const SyncChangeList& change_list) {
+ if (process_success_)
+ return SyncError();
+ return SyncError(FROM_HERE, "Process error", type_);
+}
+
+SyncError GenericChangeProcessorFake::GetSyncDataForType(
+ syncable::ModelType type, SyncDataList* current_sync_data) {
+ type_ = type;
+ if (get_sync_data_success_)
+ return SyncError();
+ return SyncError(FROM_HERE, "GetSyncData error", type);
+}
+
+bool GenericChangeProcessorFake::SyncModelHasUserCreatedNodes(
+ syncable::ModelType type, bool* has_nodes) {
+ type_ = type;
+ *has_nodes = has_nodes_;
+ return has_nodes_success_;
+}
+
+bool GenericChangeProcessorFake::CryptoReadyIfNecessary(
+ syncable::ModelType type) {
+ type_ = type;
+ return crypto_ready_;
+}
+
+} // namespace browser_sync

Powered by Google App Engine
This is Rietveld 408576698