Index: sync/engine/apply_control_data_updates_unittest.cc |
diff --git a/sync/engine/apply_control_data_updates_unittest.cc b/sync/engine/apply_control_data_updates_unittest.cc |
index 7ed6bd4899f0604a3044f142743cc43b7cf3ed7e..61c7844907088318aabac8f718afa38e94aaa5f2 100644 |
--- a/sync/engine/apply_control_data_updates_unittest.cc |
+++ b/sync/engine/apply_control_data_updates_unittest.cc |
@@ -914,4 +914,59 @@ TEST_F(ApplyControlDataUpdatesTest, ControlConflict) { |
experiments().keystore_encryption().enabled()); |
} |
+// Check that applying a EXPERIMENTS update marks the datatype as downloaded. |
+TEST_F(ApplyControlDataUpdatesTest, ExperimentsApplyMarksDownloadCompleted) { |
+ EXPECT_FALSE(directory()->InitialSyncEndedForType(EXPERIMENTS)); |
+ |
+ // Create root node for EXPERIMENTS datatype |
+ { |
+ syncable::WriteTransaction trans(FROM_HERE, UNITTEST, directory()); |
+ syncable::ModelNeutralMutableEntry entry( |
+ &trans, syncable::CREATE_NEW_TYPE_ROOT, EXPERIMENTS); |
+ ASSERT_TRUE(entry.good()); |
+ entry.PutServerIsDir(true); |
+ entry.PutUniqueServerTag(ModelTypeToRootTag(EXPERIMENTS)); |
+ } |
+ |
+ EXPECT_FALSE(directory()->InitialSyncEndedForType(EXPERIMENTS)); |
+ |
+ std::string experiment_id = "experiment"; |
+ sync_pb::EntitySpecifics specifics; |
+ specifics.mutable_experiments()->mutable_keystore_encryption()->set_enabled( |
+ true); |
+ entry_factory_->CreateUnappliedNewItem(experiment_id, specifics, false); |
+ |
+ ApplyControlDataUpdates(directory()); |
+ |
+ EXPECT_TRUE(directory()->InitialSyncEndedForType(EXPERIMENTS)); |
+ EXPECT_FALSE(directory()->InitialSyncEndedForType(NIGORI)); |
Nicolas Zea
2015/10/13 17:51:37
Did you mean to leave this in? (maybe comment why?
stanisc
2015/10/13 21:23:11
This was to verify that there is no side effect on
|
+} |
+ |
+// Check that applying a NIGORI update marks the datatype as downloaded. |
+TEST_F(ApplyControlDataUpdatesTest, NigoriApplyMarksDownloadCompleted) { |
+ EXPECT_FALSE(directory()->InitialSyncEndedForType(NIGORI)); |
+ |
+ Cryptographer* cryptographer; |
+ |
+ { |
+ syncable::ReadTransaction trans(FROM_HERE, directory()); |
+ cryptographer = directory()->GetCryptographer(&trans); |
+ } |
+ |
+ KeyParams params = {"localhost", "dummy", "foobar"}; |
+ cryptographer->AddKey(params); |
+ sync_pb::EntitySpecifics specifics; |
+ sync_pb::NigoriSpecifics* nigori = specifics.mutable_nigori(); |
+ cryptographer->GetKeys(nigori->mutable_encryption_keybag()); |
+ nigori->set_encrypt_everything(true); |
+ |
+ entry_factory_->CreateUnappliedNewItem(ModelTypeToRootTag(NIGORI), specifics, |
+ true); |
+ |
+ ApplyControlDataUpdates(directory()); |
+ |
+ EXPECT_TRUE(directory()->InitialSyncEndedForType(NIGORI)); |
+ EXPECT_FALSE(directory()->InitialSyncEndedForType(EXPERIMENTS)); |
+} |
+ |
} // namespace syncer |