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

Unified Diff: chrome/browser/sync/engine/syncer_proto_util_unittest.cc

Issue 371029: Remove unique naming. (Closed)
Patch Set: Ready and about to go in! Created 11 years, 1 month 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 | « chrome/browser/sync/engine/syncer_proto_util.cc ('k') | chrome/browser/sync/engine/syncer_types.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/sync/engine/syncer_proto_util_unittest.cc
diff --git a/chrome/browser/sync/engine/syncer_proto_util_unittest.cc b/chrome/browser/sync/engine/syncer_proto_util_unittest.cc
index dbb173071890997d2aa3a52a6ef68f05125ca755..7f7ba1f8c95badef926579fef4661031787cacc5 100644
--- a/chrome/browser/sync/engine/syncer_proto_util_unittest.cc
+++ b/chrome/browser/sync/engine/syncer_proto_util_unittest.cc
@@ -75,43 +75,62 @@ TEST(SyncerProtoUtil, NameExtractionOneName) {
SyncEntity one_name_entity;
CommitResponse_EntryResponse one_name_response;
- PathString one_name_string(PSTR("Eggheadednesses"));
- one_name_entity.set_name("Eggheadednesses");
- one_name_response.set_name("Eggheadednesses");
+ const std::string one_name_string("Eggheadednesses");
+ one_name_entity.set_name(one_name_string);
+ one_name_response.set_name(one_name_string);
- SyncName name_a = SyncerProtoUtil::NameFromSyncEntity(one_name_entity);
- EXPECT_EQ(one_name_string, name_a.value());
- EXPECT_EQ(one_name_string, name_a.non_unique_value());
+ const std::string name_a =
+ SyncerProtoUtil::NameFromSyncEntity(one_name_entity);
+ EXPECT_EQ(one_name_string, name_a);
- SyncName name_b =
+ const std::string name_b =
SyncerProtoUtil::NameFromCommitEntryResponse(one_name_response);
- EXPECT_EQ(one_name_string, name_b.value());
- EXPECT_EQ(one_name_string, name_b.non_unique_value());
+ EXPECT_EQ(one_name_string, name_b);
+ EXPECT_TRUE(name_a == name_b);
+}
+
+TEST(SyncerProtoUtil, NameExtractionOneUniqueName) {
+ SyncEntity one_name_entity;
+ CommitResponse_EntryResponse one_name_response;
+
+ const std::string one_name_string("Eggheadednesses");
+ one_name_entity.set_non_unique_name(one_name_string);
+ one_name_response.set_non_unique_name(one_name_string);
+
+ const std::string name_a =
+ SyncerProtoUtil::NameFromSyncEntity(one_name_entity);
+ EXPECT_EQ(one_name_string, name_a);
+
+ const std::string name_b =
+ SyncerProtoUtil::NameFromCommitEntryResponse(one_name_response);
+ EXPECT_EQ(one_name_string, name_b);
EXPECT_TRUE(name_a == name_b);
}
// Tests NameFromSyncEntity and NameFromCommitEntryResponse when both the name
// field and the non_unique_name fields are provided.
+// Should prioritize non_unique_name.
TEST(SyncerProtoUtil, NameExtractionTwoNames) {
SyncEntity two_name_entity;
CommitResponse_EntryResponse two_name_response;
- PathString two_name_string_unique(PSTR("Oxyphenbutazone"));
- two_name_entity.set_name("Oxyphenbutazone");
- two_name_response.set_name("Oxyphenbutazone");
- PathString two_name_string(PSTR("Neuroanatomists"));
- two_name_entity.set_non_unique_name("Neuroanatomists");
- two_name_response.set_non_unique_name("Neuroanatomists");
+ const std::string neuro("Neuroanatomists");
+ const std::string oxyphen("Oxyphenbutazone");
+
+ two_name_entity.set_name(oxyphen);
+ two_name_entity.set_non_unique_name(neuro);
+
+ two_name_response.set_name(oxyphen);
+ two_name_response.set_non_unique_name(neuro);
- SyncName name_a = SyncerProtoUtil::NameFromSyncEntity(two_name_entity);
- EXPECT_EQ(two_name_string_unique, name_a.value());
- EXPECT_EQ(two_name_string, name_a.non_unique_value());
+ const std::string name_a =
+ SyncerProtoUtil::NameFromSyncEntity(two_name_entity);
+ EXPECT_EQ(neuro, name_a);
- SyncName name_b =
+ const std::string name_b =
SyncerProtoUtil::NameFromCommitEntryResponse(two_name_response);
- EXPECT_EQ(two_name_string_unique, name_b.value());
- EXPECT_EQ(two_name_string, name_b.non_unique_value());
+ EXPECT_EQ(neuro, name_b);
EXPECT_TRUE(name_a == name_b);
}
« no previous file with comments | « chrome/browser/sync/engine/syncer_proto_util.cc ('k') | chrome/browser/sync/engine/syncer_types.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698