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

Unified Diff: sync/engine/get_updates_processor_unittest.cc

Issue 387983004: sync: Support non-blocking initial sync in proto (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase + fix comment Created 6 years, 5 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: sync/engine/get_updates_processor_unittest.cc
diff --git a/sync/engine/get_updates_processor_unittest.cc b/sync/engine/get_updates_processor_unittest.cc
index 54ce5031431ab36f6c1354b57e0d5824c380d1e6..a09ab4ef580f2ddda982c0ad4a4ff9648ee7e648 100644
--- a/sync/engine/get_updates_processor_unittest.cc
+++ b/sync/engine/get_updates_processor_unittest.cc
@@ -187,6 +187,44 @@ TEST_F(GetUpdatesProcessorTest, NotifyMany) {
}
}
+// Basic test to ensure initial sync requests are expressed in the request.
+TEST_F(GetUpdatesProcessorTest, InitialSyncRequest) {
+ sessions::NudgeTracker nudge_tracker;
+ nudge_tracker.RecordInitialSyncRequired(AUTOFILL);
+ nudge_tracker.RecordInitialSyncRequired(PREFERENCES);
+
+ ModelTypeSet initial_sync_types = ModelTypeSet(AUTOFILL, PREFERENCES);
+
+ sync_pb::ClientToServerMessage message;
+ NormalGetUpdatesDelegate normal_delegate(nudge_tracker);
+ scoped_ptr<GetUpdatesProcessor> processor(
+ BuildGetUpdatesProcessor(normal_delegate));
+ processor->PrepareGetUpdates(enabled_types(), &message);
+
+ const sync_pb::GetUpdatesMessage& gu_msg = message.get_updates();
+ EXPECT_EQ(sync_pb::GetUpdatesCallerInfo::DATATYPE_REFRESH,
+ gu_msg.caller_info().source());
+ EXPECT_EQ(sync_pb::SyncEnums::GU_TRIGGER, gu_msg.get_updates_origin());
+ for (int i = 0; i < gu_msg.from_progress_marker_size(); ++i) {
+ syncer::ModelType type = GetModelTypeFromSpecificsFieldNumber(
+ gu_msg.from_progress_marker(i).data_type_id());
+
+ const sync_pb::DataTypeProgressMarker& progress_marker =
+ gu_msg.from_progress_marker(i);
+ const sync_pb::GetUpdateTriggers& gu_trigger =
+ progress_marker.get_update_triggers();
+
+ // We perform some basic tests of GU trigger and source fields here. The
+ // more complicated scenarios are tested by the NudgeTracker tests.
+ if (initial_sync_types.Has(type)) {
+ EXPECT_TRUE(gu_trigger.initial_sync_in_progress());
+ } else {
+ EXPECT_TRUE(gu_trigger.has_initial_sync_in_progress());
+ EXPECT_FALSE(gu_trigger.initial_sync_in_progress());
+ }
+ }
+}
+
TEST_F(GetUpdatesProcessorTest, ConfigureTest) {
sync_pb::ClientToServerMessage message;
ConfigureGetUpdatesDelegate configure_delegate(

Powered by Google App Engine
This is Rietveld 408576698