| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "components/password_manager/core/browser/password_syncable_service.h" | 5 #include "components/password_manager/core/browser/password_syncable_service.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 545 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 556 form.signon_realm = kSignonRealm2; | 556 form.signon_realm = kSignonRealm2; |
| 557 PasswordStoreChangeList list; | 557 PasswordStoreChangeList list; |
| 558 list.push_back(PasswordStoreChange(PasswordStoreChange::ADD, form)); | 558 list.push_back(PasswordStoreChange(PasswordStoreChange::ADD, form)); |
| 559 service()->ActOnPasswordStoreChanges(list); | 559 service()->ActOnPasswordStoreChanges(list); |
| 560 } | 560 } |
| 561 | 561 |
| 562 // Serialize and deserialize empty federation_origin and make sure it's an empty | 562 // Serialize and deserialize empty federation_origin and make sure it's an empty |
| 563 // string. | 563 // string. |
| 564 TEST_F(PasswordSyncableServiceTest, SerializeEmptyFederation) { | 564 TEST_F(PasswordSyncableServiceTest, SerializeEmptyFederation) { |
| 565 autofill::PasswordForm form; | 565 autofill::PasswordForm form; |
| 566 EXPECT_TRUE(form.federation_origin.unique()); | 566 EXPECT_TRUE(form.federation_origin.opaque()); |
| 567 syncer::SyncData data = SyncDataFromPassword(form); | 567 syncer::SyncData data = SyncDataFromPassword(form); |
| 568 const sync_pb::PasswordSpecificsData& specifics = GetPasswordSpecifics(data); | 568 const sync_pb::PasswordSpecificsData& specifics = GetPasswordSpecifics(data); |
| 569 EXPECT_TRUE(specifics.has_federation_url()); | 569 EXPECT_TRUE(specifics.has_federation_url()); |
| 570 EXPECT_EQ(std::string(), specifics.federation_url()); | 570 EXPECT_EQ(std::string(), specifics.federation_url()); |
| 571 | 571 |
| 572 // Deserialize back. | 572 // Deserialize back. |
| 573 form = PasswordFromSpecifics(specifics); | 573 form = PasswordFromSpecifics(specifics); |
| 574 EXPECT_TRUE(form.federation_origin.unique()); | 574 EXPECT_TRUE(form.federation_origin.opaque()); |
| 575 | 575 |
| 576 // Make sure that the Origins uploaded incorrectly are still deserialized | 576 // Make sure that the Origins uploaded incorrectly are still deserialized |
| 577 // correctly. | 577 // correctly. |
| 578 // crbug.com/593380. | 578 // crbug.com/593380. |
| 579 sync_pb::PasswordSpecificsData specifics1; | 579 sync_pb::PasswordSpecificsData specifics1; |
| 580 specifics1.set_federation_url("null"); | 580 specifics1.set_federation_url("null"); |
| 581 form = PasswordFromSpecifics(specifics1); | 581 form = PasswordFromSpecifics(specifics1); |
| 582 EXPECT_TRUE(form.federation_origin.unique()); | 582 EXPECT_TRUE(form.federation_origin.opaque()); |
| 583 } | 583 } |
| 584 | 584 |
| 585 // Serialize empty PasswordForm and make sure the Sync representation is | 585 // Serialize empty PasswordForm and make sure the Sync representation is |
| 586 // matching the expectations | 586 // matching the expectations |
| 587 TEST_F(PasswordSyncableServiceTest, SerializeEmptyPasswordForm) { | 587 TEST_F(PasswordSyncableServiceTest, SerializeEmptyPasswordForm) { |
| 588 autofill::PasswordForm form; | 588 autofill::PasswordForm form; |
| 589 syncer::SyncData data = SyncDataFromPassword(form); | 589 syncer::SyncData data = SyncDataFromPassword(form); |
| 590 const sync_pb::PasswordSpecificsData& specifics = GetPasswordSpecifics(data); | 590 const sync_pb::PasswordSpecificsData& specifics = GetPasswordSpecifics(data); |
| 591 EXPECT_TRUE(specifics.has_scheme()); | 591 EXPECT_TRUE(specifics.has_scheme()); |
| 592 EXPECT_EQ(0, specifics.scheme()); | 592 EXPECT_EQ(0, specifics.scheme()); |
| (...skipping 622 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1215 std::unique_ptr<syncer::SyncErrorFactory>()); | 1215 std::unique_ptr<syncer::SyncErrorFactory>()); |
| 1216 wrapper.reset(); | 1216 wrapper.reset(); |
| 1217 // Wait til PasswordStore is destroy end therefore all the expectations on | 1217 // Wait til PasswordStore is destroy end therefore all the expectations on |
| 1218 // it are checked. | 1218 // it are checked. |
| 1219 scoped_task_environment_.RunUntilIdle(); | 1219 scoped_task_environment_.RunUntilIdle(); |
| 1220 } | 1220 } |
| 1221 | 1221 |
| 1222 } // namespace | 1222 } // namespace |
| 1223 | 1223 |
| 1224 } // namespace password_manager | 1224 } // namespace password_manager |
| OLD | NEW |