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

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

Issue 1778423002: Don't upload "null" to the Sync server for empty federation_url. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2661
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
« no previous file with comments | « components/password_manager/core/browser/password_syncable_service.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..64a3fc00979c70c90063193322517eda0690b12d 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 deserialized
+ // correctly.
+ // crbug.com/593380.
+ sync_pb::PasswordSpecificsData specifics1;
+ specifics1.set_federation_url("null");
+ form = PasswordFromSpecifics(specifics1);
+ EXPECT_TRUE(form.federation_origin.unique());
+}
+
} // namespace
} // namespace password_manager
« no previous file with comments | « components/password_manager/core/browser/password_syncable_service.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698