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

Side by Side Diff: sync/engine/apply_control_data_updates_unittest.cc

Issue 1393633003: Sync: fix for the code that checks whether the initial download has completed (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed control data types and added unit tests Created 5 years, 2 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 unified diff | Download patch
OLDNEW
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
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 control update marks the datatype as downloaded.
918 TEST_F(ApplyControlDataUpdatesTest, ControlApplyMarksDownloadCompleted) {
919 {
920 syncable::WriteTransaction trans(FROM_HERE, UNITTEST, directory());
921 syncable::ModelNeutralMutableEntry entry(
922 &trans, syncable::CREATE_NEW_TYPE_ROOT, EXPERIMENTS);
923 ASSERT_TRUE(entry.good());
924 entry.PutServerIsDir(true);
925 entry.PutUniqueServerTag(ModelTypeToRootTag(EXPERIMENTS));
926 }
927
928 EXPECT_FALSE(directory()->InitialSyncEndedForType(EXPERIMENTS));
Nicolas Zea 2015/10/09 22:23:34 This test doesn't cover the case where there are n
stanisc 2015/10/10 00:44:18 This case handles control types with implicit perm
929
930 std::string experiment_id = "experiment";
931 sync_pb::EntitySpecifics specifics;
932 specifics.mutable_experiments()->mutable_keystore_encryption()->set_enabled(
933 true);
934 entry_factory_->CreateUnappliedNewItem(experiment_id, specifics, false);
935
936 ApplyControlDataUpdates(directory());
937
938 EXPECT_TRUE(directory()->InitialSyncEndedForType(EXPERIMENTS));
939 }
940
917 } // namespace syncer 941 } // namespace syncer
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698