Commit 0830f62f authored by Sébastien Séguin-Gagnon's avatar Sébastien Séguin-Gagnon Committed by Commit Bot

[AF USS] Add single client wallet tests for server profiles.

Bug: 869526
Change-Id: Iacf585f600d12461dbd62171f0936e50f78d6057
Reviewed-on: https://chromium-review.googlesource.com/1170097
Commit-Queue: Sebastien Seguin-Gagnon <sebsg@chromium.org>
Reviewed-by: default avatarJan Krcal <jkrcal@chromium.org>
Cr-Commit-Position: refs/heads/master@{#582155}
parent bf96868c
...@@ -118,6 +118,14 @@ void SetServerCardsOnDBSequence( ...@@ -118,6 +118,14 @@ void SetServerCardsOnDBSequence(
->SetServerCreditCards(credit_cards); ->SetServerCreditCards(credit_cards);
} }
void SetServerProfilesOnDBSequence(
AutofillWebDataService* wds,
const std::vector<autofill::AutofillProfile>& profiles) {
DCHECK(wds->GetDBTaskRunner()->RunsTasksInCurrentSequence());
AutofillTable::FromWebDatabase(wds->GetDatabase())
->SetServerProfiles(profiles);
}
bool ProfilesMatchImpl( bool ProfilesMatchImpl(
int profile_a, int profile_a,
const std::vector<AutofillProfile*>& autofill_profiles_a, const std::vector<AutofillProfile*>& autofill_profiles_a,
...@@ -302,6 +310,15 @@ void SetServerCreditCards( ...@@ -302,6 +310,15 @@ void SetServerCreditCards(
WaitForCurrentTasksToComplete(wds->GetDBTaskRunner()); WaitForCurrentTasksToComplete(wds->GetDBTaskRunner());
} }
void SetServerProfiles(int profile,
const std::vector<autofill::AutofillProfile>& profiles) {
scoped_refptr<AutofillWebDataService> wds = GetProfileWebDataService(profile);
wds->GetDBTaskRunner()->PostTask(
FROM_HERE, base::BindOnce(&SetServerProfilesOnDBSequence,
base::Unretained(wds.get()), profiles));
WaitForCurrentTasksToComplete(wds->GetDBTaskRunner());
}
void AddProfile(int profile, const AutofillProfile& autofill_profile) { void AddProfile(int profile, const AutofillProfile& autofill_profile) {
std::vector<AutofillProfile> autofill_profiles; std::vector<AutofillProfile> autofill_profiles;
for (AutofillProfile* profile : GetAllAutoFillProfiles(profile)) { for (AutofillProfile* profile : GetAllAutoFillProfiles(profile)) {
......
...@@ -79,6 +79,9 @@ void SetServerCreditCards( ...@@ -79,6 +79,9 @@ void SetServerCreditCards(
int profile, int profile,
const std::vector<autofill::CreditCard>& credit_cards); const std::vector<autofill::CreditCard>& credit_cards);
void SetServerProfiles(int profile,
const std::vector<autofill::AutofillProfile>& profiles);
// Adds the autofill profile |autofill_profile| to sync profile |profile|. // Adds the autofill profile |autofill_profile| to sync profile |profile|.
void AddProfile(int profile, const autofill::AutofillProfile& autofill_profile); void AddProfile(int profile, const autofill::AutofillProfile& autofill_profile);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment