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

Unified Diff: sync/internal_api/sync_manager_impl_unittest.cc

Issue 1134793006: [Sync] WriteNode::SetTitle doesn't update bookmark title when it is empty string. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Small change after Nicolas' feedback. Created 5 years, 7 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 | « no previous file | sync/internal_api/write_node.cc » ('j') | 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 222e7e825262255dc6cec0cf6c6bbc7512a386cc..41b2e2df4b812fe06aa8eac08a32809131e66088 100644
--- a/sync/internal_api/sync_manager_impl_unittest.cc
+++ b/sync/internal_api/sync_manager_impl_unittest.cc
@@ -572,6 +572,35 @@ TEST_F(SyncApiTest, WriteEncryptedTitle) {
}
}
+// Non-unique name should not be empty. For bookmarks non-unique name is copied
+// from bookmark title. This test verifies that setting bookmark title to ""
+// results in single space title and non-unique name in internal representation.
+// GetTitle should still return empty string.
+TEST_F(SyncApiTest, WriteEmptyBookmarkTitle) {
+ int bookmark_id;
+ {
+ WriteTransaction trans(FROM_HERE, user_share());
+ ReadNode root_node(&trans);
+ root_node.InitByRootLookup();
+
+ WriteNode bookmark_node(&trans);
+ ASSERT_TRUE(bookmark_node.InitBookmarkByCreation(root_node, NULL));
+ bookmark_id = bookmark_node.GetId();
+ bookmark_node.SetTitle("");
+ }
+ {
+ ReadTransaction trans(FROM_HERE, user_share());
+ ReadNode root_node(&trans);
+ root_node.InitByRootLookup();
+
+ ReadNode bookmark_node(&trans);
+ ASSERT_EQ(BaseNode::INIT_OK, bookmark_node.InitByIdLookup(bookmark_id));
+ EXPECT_EQ("", bookmark_node.GetTitle());
+ EXPECT_EQ(" ", bookmark_node.GetEntry()->GetSpecifics().bookmark().title());
+ EXPECT_EQ(" ", bookmark_node.GetEntry()->GetNonUniqueName());
+ }
+}
+
TEST_F(SyncApiTest, BaseNodeSetSpecifics) {
int64 child_id = MakeNodeWithRoot(user_share(), BOOKMARKS, "testtag");
WriteTransaction trans(FROM_HERE, user_share());
« no previous file with comments | « no previous file | sync/internal_api/write_node.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698