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

Unified Diff: components/sync/model_impl/processor_entity_tracker_unittest.cc

Issue 2915763005: [Sync] Implement support for updating storage key for new entities (Closed)
Patch Set: Rebase. Fix recommit for encryption scenario. Created 3 years, 6 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: components/sync/model_impl/processor_entity_tracker_unittest.cc
diff --git a/components/sync/model_impl/processor_entity_tracker_unittest.cc b/components/sync/model_impl/processor_entity_tracker_unittest.cc
index e23b9f581eacbdcb8d510a3e906e029a0ab949fb..e79e2850db989cc9211de88b952388155801dc02 100644
--- a/components/sync/model_impl/processor_entity_tracker_unittest.cc
+++ b/components/sync/model_impl/processor_entity_tracker_unittest.cc
@@ -107,6 +107,9 @@ class ProcessorEntityTrackerTest : public ::testing::Test {
std::unique_ptr<ProcessorEntityTracker> CreateNew() {
return ProcessorEntityTracker::CreateNew(kKey, kHash, "", ctime_);
}
+ std::unique_ptr<ProcessorEntityTracker> CreateNewWithEmptyStorageKey() {
+ return ProcessorEntityTracker::CreateNew("", kHash, "", ctime_);
+ }
std::unique_ptr<ProcessorEntityTracker> CreateSynced() {
std::unique_ptr<ProcessorEntityTracker> entity = CreateNew();
@@ -242,6 +245,21 @@ TEST_F(ProcessorEntityTrackerTest, NewServerItem) {
EXPECT_FALSE(entity->HasCommitData());
}
+// Test creating tracker for new server item with empty storage key, applying
+// update and updating storage key.
+TEST_F(ProcessorEntityTrackerTest, NewServerItem_EmptyStorageKey) {
+ std::unique_ptr<ProcessorEntityTracker> entity =
+ CreateNewWithEmptyStorageKey();
+
+ EXPECT_EQ("", entity->storage_key());
+
+ const base::Time mtime = base::Time::Now();
+ entity->RecordAcceptedUpdate(
+ GenerateUpdate(*entity, kHash, kId, kName, kValue1, mtime, 10));
+ entity->SetStorageKey(kKey);
+ EXPECT_EQ(kKey, entity->storage_key());
+}
+
// Test state for a tombstone received for a previously unknown item.
TEST_F(ProcessorEntityTrackerTest, NewServerTombstone) {
std::unique_ptr<ProcessorEntityTracker> entity = CreateNew();
« no previous file with comments | « components/sync/model_impl/processor_entity_tracker.cc ('k') | components/sync/model_impl/shared_model_type_processor.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698