OLD | NEW |
---|---|
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "base/format_macros.h" | 5 #include "base/format_macros.h" |
6 #include "base/location.h" | 6 #include "base/location.h" |
7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
9 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
10 #include "sync/engine/apply_control_data_updates.h" | 10 #include "sync/engine/apply_control_data_updates.h" |
(...skipping 896 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
907 entry_factory_->SetLocalSpecificsForItem(experiment_handle, | 907 entry_factory_->SetLocalSpecificsForItem(experiment_handle, |
908 local_specifics); | 908 local_specifics); |
909 ApplyControlDataUpdates(directory()); | 909 ApplyControlDataUpdates(directory()); |
910 | 910 |
911 EXPECT_FALSE(entry_factory_->GetIsUnappliedForItem(experiment_handle)); | 911 EXPECT_FALSE(entry_factory_->GetIsUnappliedForItem(experiment_handle)); |
912 EXPECT_TRUE( | 912 EXPECT_TRUE( |
913 entry_factory_->GetLocalSpecificsForItem(experiment_handle). | 913 entry_factory_->GetLocalSpecificsForItem(experiment_handle). |
914 experiments().keystore_encryption().enabled()); | 914 experiments().keystore_encryption().enabled()); |
915 } | 915 } |
916 | 916 |
917 // Check that applying a EXPERIMENTS update marks the datatype as downloaded. | |
918 TEST_F(ApplyControlDataUpdatesTest, ExperimentsApplyMarksDownloadCompleted) { | |
919 EXPECT_FALSE(directory()->InitialSyncEndedForType(EXPERIMENTS)); | |
920 | |
921 // Create root node for EXPERIMENTS datatype | |
922 { | |
923 syncable::WriteTransaction trans(FROM_HERE, UNITTEST, directory()); | |
924 syncable::ModelNeutralMutableEntry entry( | |
925 &trans, syncable::CREATE_NEW_TYPE_ROOT, EXPERIMENTS); | |
926 ASSERT_TRUE(entry.good()); | |
927 entry.PutServerIsDir(true); | |
928 entry.PutUniqueServerTag(ModelTypeToRootTag(EXPERIMENTS)); | |
929 } | |
930 | |
931 EXPECT_FALSE(directory()->InitialSyncEndedForType(EXPERIMENTS)); | |
932 | |
933 std::string experiment_id = "experiment"; | |
934 sync_pb::EntitySpecifics specifics; | |
935 specifics.mutable_experiments()->mutable_keystore_encryption()->set_enabled( | |
936 true); | |
937 entry_factory_->CreateUnappliedNewItem(experiment_id, specifics, false); | |
938 | |
939 ApplyControlDataUpdates(directory()); | |
940 | |
941 EXPECT_TRUE(directory()->InitialSyncEndedForType(EXPERIMENTS)); | |
942 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
| |
943 } | |
944 | |
945 // Check that applying a NIGORI update marks the datatype as downloaded. | |
946 TEST_F(ApplyControlDataUpdatesTest, NigoriApplyMarksDownloadCompleted) { | |
947 EXPECT_FALSE(directory()->InitialSyncEndedForType(NIGORI)); | |
948 | |
949 Cryptographer* cryptographer; | |
950 | |
951 { | |
952 syncable::ReadTransaction trans(FROM_HERE, directory()); | |
953 cryptographer = directory()->GetCryptographer(&trans); | |
954 } | |
955 | |
956 KeyParams params = {"localhost", "dummy", "foobar"}; | |
957 cryptographer->AddKey(params); | |
958 sync_pb::EntitySpecifics specifics; | |
959 sync_pb::NigoriSpecifics* nigori = specifics.mutable_nigori(); | |
960 cryptographer->GetKeys(nigori->mutable_encryption_keybag()); | |
961 nigori->set_encrypt_everything(true); | |
962 | |
963 entry_factory_->CreateUnappliedNewItem(ModelTypeToRootTag(NIGORI), specifics, | |
964 true); | |
965 | |
966 ApplyControlDataUpdates(directory()); | |
967 | |
968 EXPECT_TRUE(directory()->InitialSyncEndedForType(NIGORI)); | |
969 EXPECT_FALSE(directory()->InitialSyncEndedForType(EXPERIMENTS)); | |
970 } | |
971 | |
917 } // namespace syncer | 972 } // namespace syncer |
OLD | NEW |