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

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

Issue 10387144: [Sync] - Implement isolated model association. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: For submitting. Created 8 years, 7 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/fake_data_type_controller.cc
diff --git a/chrome/browser/sync/glue/fake_data_type_controller.cc b/chrome/browser/sync/glue/fake_data_type_controller.cc
index d58b3e1596c2a33fa2bbd62051afa6f2934563d9..1f837a299d8cbbb2b892fba67e63c48cef2a0ac4 100644
--- a/chrome/browser/sync/glue/fake_data_type_controller.cc
+++ b/chrome/browser/sync/glue/fake_data_type_controller.cc
@@ -14,20 +14,26 @@ using syncable::ModelType;
namespace browser_sync {
FakeDataTypeController::FakeDataTypeController(ModelType type)
- : state_(NOT_RUNNING), type_(type) {}
+ : state_(NOT_RUNNING), model_load_delayed_(false), type_(type) {}
FakeDataTypeController::~FakeDataTypeController() {
}
-// NOT_RUNNING ->MODEL_LOADED.
+// NOT_RUNNING ->MODEL_LOADED |MODEL_STARTING.
void FakeDataTypeController::LoadModels(
const ModelLoadCallback& model_load_callback) {
if (state_ != NOT_RUNNING) {
ADD_FAILURE();
return;
}
- model_load_callback.Run(type(), SyncError());
- state_ = MODEL_LOADED;
+
+ if (model_load_delayed_ == false) {
+ model_load_callback.Run(type(), SyncError());
+ state_ = MODEL_LOADED;
+ } else {
+ model_load_callback_ = model_load_callback;
+ state_ = MODEL_STARTING;
+ }
}
void FakeDataTypeController::OnModelLoaded() {
@@ -38,7 +44,7 @@ void FakeDataTypeController::OnModelLoaded() {
void FakeDataTypeController::StartAssociating(
const StartCallback& start_callback) {
last_start_callback_ = start_callback;
- state_ = MODEL_STARTING;
+ state_ = ASSOCIATING;
}
// MODEL_STARTING | ASSOCIATING -> RUNNING | DISABLED | NOT_RUNNING
@@ -111,5 +117,14 @@ void FakeDataTypeController::RecordUnrecoverableError(
ADD_FAILURE() << message;
}
+void FakeDataTypeController::SetDelayModelLoad() {
+ model_load_delayed_ = true;
+}
+
+void FakeDataTypeController::SimulateModelLoadFinishing() {
+ ModelLoadCallback model_load_callback = model_load_callback_;
+ model_load_callback.Run(type(), SyncError());
+}
+
} // namespace browser_sync
« no previous file with comments | « chrome/browser/sync/glue/fake_data_type_controller.h ('k') | chrome/browser/sync/glue/frontend_data_type_controller_mock.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698