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

Unified Diff: components/password_manager/core/browser/password_syncable_service_unittest.cc

Issue 1780683002: Don't upload "null" to the Sync server for empty federation_url. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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
Index: components/password_manager/core/browser/password_syncable_service_unittest.cc
diff --git a/components/password_manager/core/browser/password_syncable_service_unittest.cc b/components/password_manager/core/browser/password_syncable_service_unittest.cc
index f8533604ed8352ec3d1cd710d87be50b2e9a021e..8f51ddf8bf1740ca7f0f2815fb88a71eab5d76cc 100644
--- a/components/password_manager/core/browser/password_syncable_service_unittest.cc
+++ b/components/password_manager/core/browser/password_syncable_service_unittest.cc
@@ -586,6 +586,29 @@ TEST_F(PasswordSyncableServiceTest, MergeEmptyPasswords) {
scoped_ptr<syncer::SyncErrorFactory>());
}
+// Serialize and deserialize empty federation_origin and make sure it's an empty
+// string.
+TEST_F(PasswordSyncableServiceTest, SerializeEmptyFederation) {
+ autofill::PasswordForm form;
+ EXPECT_TRUE(form.federation_origin.unique());
+ syncer::SyncData data = SyncDataFromPassword(form);
+ const sync_pb::PasswordSpecificsData& specifics = GetPasswordSpecifics(data);
+ EXPECT_TRUE(specifics.has_federation_url());
+ EXPECT_EQ(std::string(), specifics.federation_url());
+
+ // Deserialize back.
+ form = PasswordFromSpecifics(specifics);
+ EXPECT_TRUE(form.federation_origin.unique());
+
+ // Make sure that the Origins uploaded incorrectly are still dwonloaded
markusheintz_ 2016/03/09 18:05:50 typo: downloaded nit: They are not downloaded cor
vasilii 2016/03/09 18:11:20 Done.
+ // correctly.
+ // crbug.com/589016.
+ sync_pb::PasswordSpecificsData specifics1;
+ specifics1.set_federation_url("null");
+ form = PasswordFromSpecifics(specifics1);
+ EXPECT_TRUE(form.federation_origin.unique());
+}
+
} // namespace
} // namespace password_manager

Powered by Google App Engine
This is Rietveld 408576698