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

Side by Side Diff: components/autofill/core/browser/personal_data_manager_unittest.cc

Issue 1785923010: Remove kAutofillWalletSyncExperimentEnabled. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Mark wallet_sync as obsolete, remove wallet_sync_enabled. 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 unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 <stddef.h> 5 #include <stddef.h>
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 .WillOnce(QuitMainMessageLoop()); 160 .WillOnce(QuitMainMessageLoop());
161 base::MessageLoop::current()->Run(); 161 base::MessageLoop::current()->Run();
162 } 162 }
163 163
164 void ResetProfiles() { 164 void ResetProfiles() {
165 std::vector<AutofillProfile> empty_profiles; 165 std::vector<AutofillProfile> empty_profiles;
166 personal_data_->SetProfiles(&empty_profiles); 166 personal_data_->SetProfiles(&empty_profiles);
167 } 167 }
168 168
169 void EnableWalletCardImport() { 169 void EnableWalletCardImport() {
170 prefs_->SetBoolean(prefs::kAutofillWalletSyncExperimentEnabled, true);
171 signin_manager_->SetAuthenticatedAccountInfo("12345", 170 signin_manager_->SetAuthenticatedAccountInfo("12345",
172 "syncuser@example.com"); 171 "syncuser@example.com");
173 base::CommandLine::ForCurrentProcess()->AppendSwitch( 172 base::CommandLine::ForCurrentProcess()->AppendSwitch(
174 switches::kEnableOfferStoreUnmaskedWalletCards); 173 switches::kEnableOfferStoreUnmaskedWalletCards);
175 } 174 }
176 175
177 void SetupReferenceProfile() { 176 void SetupReferenceProfile() {
178 ASSERT_EQ(0U, personal_data_->GetProfiles().size()); 177 ASSERT_EQ(0U, personal_data_->GetProfiles().size());
179 178
180 AutofillProfile profile(base::GenerateGUID(), "https://www.example.com"); 179 AutofillProfile profile(base::GenerateGUID(), "https://www.example.com");
(...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after
599 personal_data_->GetProfiles(); 598 personal_data_->GetProfiles();
600 const std::vector<CreditCard*>& cards3 = personal_data_->GetCreditCards(); 599 const std::vector<CreditCard*>& cards3 = personal_data_->GetCreditCards();
601 ASSERT_EQ(1U, profiles3.size()); 600 ASSERT_EQ(1U, profiles3.size());
602 ASSERT_EQ(1U, cards3.size()); 601 ASSERT_EQ(1U, cards3.size());
603 EXPECT_EQ(0, profile.Compare(*profiles3[0])); 602 EXPECT_EQ(0, profile.Compare(*profiles3[0]));
604 EXPECT_EQ(0, credit_card.Compare(*cards3[0])); 603 EXPECT_EQ(0, credit_card.Compare(*cards3[0]));
605 EXPECT_EQ(profile.origin(), profiles3[0]->origin()); 604 EXPECT_EQ(profile.origin(), profiles3[0]->origin());
606 EXPECT_EQ(credit_card.origin(), cards3[0]->origin()); 605 EXPECT_EQ(credit_card.origin(), cards3[0]->origin());
607 } 606 }
608 607
609 // Tests that server cards are ignored without the flag.
610 TEST_F(PersonalDataManagerTest, ReturnsServerCreditCards) {
611 std::vector<CreditCard> server_cards;
612 server_cards.push_back(CreditCard(CreditCard::MASKED_SERVER_CARD, "a123"));
613 test::SetCreditCardInfo(&server_cards.back(), "John Dillinger",
614 "9012" /* Visa */, "01", "2010");
615 server_cards.back().SetTypeForMaskedCard(kVisaCard);
616
617 server_cards.push_back(CreditCard(CreditCard::MASKED_SERVER_CARD, "b456"));
618 test::SetCreditCardInfo(&server_cards.back(), "Bonnie Parker",
619 "2109" /* Mastercard */, "12", "2012");
620 server_cards.back().SetTypeForMaskedCard(kMasterCard);
621
622 test::SetServerCreditCards(autofill_table_, server_cards);
623 personal_data_->Refresh();
624
625 EXPECT_CALL(personal_data_observer_, OnPersonalDataChanged())
626 .WillOnce(QuitMainMessageLoop());
627 base::MessageLoop::current()->Run();
628
629 EXPECT_EQ(0U, personal_data_->GetCreditCards().size());
630 }
631
632 // Makes sure that full cards are re-masked when full PAN storage is off. 608 // Makes sure that full cards are re-masked when full PAN storage is off.
633 TEST_F(PersonalDataManagerTest, RefuseToStoreFullCard) { 609 TEST_F(PersonalDataManagerTest, RefuseToStoreFullCard) {
634 prefs_->SetBoolean(prefs::kAutofillWalletSyncExperimentEnabled, true);
635
636 // On Linux this should be disabled automatically. Elsewhere, only if the 610 // On Linux this should be disabled automatically. Elsewhere, only if the
637 // flag is passed. 611 // flag is passed.
638 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) 612 #if defined(OS_LINUX) && !defined(OS_CHROMEOS)
639 EXPECT_FALSE(base::CommandLine::ForCurrentProcess()->HasSwitch( 613 EXPECT_FALSE(base::CommandLine::ForCurrentProcess()->HasSwitch(
640 switches::kDisableOfferStoreUnmaskedWalletCards)); 614 switches::kDisableOfferStoreUnmaskedWalletCards));
641 #else 615 #else
642 base::CommandLine::ForCurrentProcess()->AppendSwitch( 616 base::CommandLine::ForCurrentProcess()->AppendSwitch(
643 switches::kDisableOfferStoreUnmaskedWalletCards); 617 switches::kDisableOfferStoreUnmaskedWalletCards);
644 #endif 618 #endif
645 619
(...skipping 3157 matching lines...) Expand 10 before | Expand all | Expand 10 after
3803 EXPECT_GT(base::TimeDelta::FromMilliseconds(500), 3777 EXPECT_GT(base::TimeDelta::FromMilliseconds(500),
3804 base::Time::Now() - saved_profiles.front()->use_date()); 3778 base::Time::Now() - saved_profiles.front()->use_date());
3805 } 3779 }
3806 3780
3807 // Erase the profiles for the next test. 3781 // Erase the profiles for the next test.
3808 ResetProfiles(); 3782 ResetProfiles();
3809 } 3783 }
3810 } 3784 }
3811 3785
3812 } // namespace autofill 3786 } // namespace autofill
OLDNEW
« no previous file with comments | « components/autofill/core/browser/personal_data_manager.cc ('k') | components/autofill/core/common/autofill_pref_names.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698