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

Unified Diff: sync/internal_api/sync_manager_impl_unittest.cc

Issue 993153002: Sync: ChangeReorderBuffer::Traversal should handle nodes with unset Parent ID (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 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
« no previous file with comments | « sync/internal_api/change_reorder_buffer.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sync/internal_api/sync_manager_impl_unittest.cc
diff --git a/sync/internal_api/sync_manager_impl_unittest.cc b/sync/internal_api/sync_manager_impl_unittest.cc
index 5e69ec5bea44318f3af3c0db50a921f8ce4a37d3..2262e0545161593aa46eb7cea878ef71150dd836 100644
--- a/sync/internal_api/sync_manager_impl_unittest.cc
+++ b/sync/internal_api/sync_manager_impl_unittest.cc
@@ -2896,6 +2896,39 @@ TEST_F(SyncManagerChangeProcessingTest, AddBookmarks) {
EXPECT_LT(folder_change_pos, child_change_pos);
}
+// Test creation of a preferences (with implicit parent Id)
+TEST_F(SyncManagerChangeProcessingTest, AddPreferences) {
+ int64 item1_id = kInvalidId;
+ int64 item2_id = kInvalidId;
+
+ // Create two preferences.
+ {
+ syncable::WriteTransaction trans(FROM_HERE, syncable::SYNCER,
+ share()->directory.get());
+
+ syncable::MutableEntry item1(&trans, syncable::CREATE, PREFERENCES,
+ "test_item_1");
+ ASSERT_TRUE(item1.good());
+ SetNodeProperties(&item1);
+ item1_id = item1.GetMetahandle();
+
+ // Need at least two items to ensure hitting all possible codepaths in
+ // ChangeReorderBuffer::Traversal::ExpandToInclude.
+ syncable::MutableEntry item2(&trans, syncable::CREATE, PREFERENCES,
+ "test_item_2");
+ ASSERT_TRUE(item2.good());
+ SetNodeProperties(&item2);
+ item2_id = item2.GetMetahandle();
+ }
+
+ // The closing of the above scope will delete the transaction. Its processed
+ // changes should be waiting for us in a member of the test harness.
+ EXPECT_EQ(2UL, GetChangeListSize());
+
+ FindChangeInList(item1_id, ChangeRecord::ACTION_ADD);
+ FindChangeInList(item2_id, ChangeRecord::ACTION_ADD);
+}
+
// Test moving a bookmark into an empty folder.
TEST_F(SyncManagerChangeProcessingTest, MoveBookmarkIntoEmptyFolder) {
int64 type_root = GetIdForDataType(BOOKMARKS);
« no previous file with comments | « sync/internal_api/change_reorder_buffer.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698