two_client_autofill_sync_test.cc revision a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7
1// Copyright (c) 2012 The Chromium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#include "base/strings/utf_string_conversions.h"
6#include "chrome/browser/sync/profile_sync_service_harness.h"
7#include "chrome/browser/sync/test/integration/autofill_helper.h"
8#include "chrome/browser/sync/test/integration/bookmarks_helper.h"
9#include "chrome/browser/sync/test/integration/sync_test.h"
10#include "components/autofill/core/browser/autofill_profile.h"
11#include "components/autofill/core/browser/credit_card.h"
12#include "components/autofill/core/browser/personal_data_manager.h"
13#include "components/autofill/core/browser/webdata/autofill_entry.h"
14#include "components/autofill/core/browser/webdata/autofill_table.h"
15
16using autofill::AutofillKey;
17using autofill::AutofillTable;
18using autofill::AutofillProfile;
19using autofill::AutofillType;
20using autofill::CreditCard;
21using autofill::PersonalDataManager;
22using autofill_helper::AddKeys;
23using autofill_helper::AddProfile;
24using autofill_helper::CreateAutofillProfile;
25using autofill_helper::GetAllKeys;
26using autofill_helper::GetAllProfiles;
27using autofill_helper::GetPersonalDataManager;
28using autofill_helper::KeysMatch;
29using autofill_helper::ProfilesMatch;
30using autofill_helper::PROFILE_FRASIER;
31using autofill_helper::PROFILE_HOMER;
32using autofill_helper::PROFILE_MARION;
33using autofill_helper::PROFILE_NULL;
34using autofill_helper::RemoveKey;
35using autofill_helper::RemoveProfile;
36using autofill_helper::SetCreditCards;
37using autofill_helper::UpdateProfile;
38using bookmarks_helper::AddFolder;
39using bookmarks_helper::AddURL;
40using bookmarks_helper::IndexedURL;
41using bookmarks_helper::IndexedURLTitle;
42
43class TwoClientAutofillSyncTest : public SyncTest {
44 public:
45  TwoClientAutofillSyncTest() : SyncTest(TWO_CLIENT) { count = 0; }
46  virtual ~TwoClientAutofillSyncTest() {}
47
48  // We do this so as to make a change that will trigger the autofill to sync.
49  // By default autofill does not sync unless there is some other change.
50  void MakeABookmarkChange(int profile) {
51    ASSERT_TRUE(
52        AddURL(profile, IndexedURLTitle(count), GURL(IndexedURL(count))));
53    ++count;
54  }
55 private:
56  int count;
57  DISALLOW_COPY_AND_ASSIGN(TwoClientAutofillSyncTest);
58};
59
60IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, WebDataServiceSanity) {
61  ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
62
63  // Client0 adds a key.
64  std::set<AutofillKey> keys;
65  keys.insert(AutofillKey("name0", "value0"));
66  AddKeys(0, keys);
67  MakeABookmarkChange(0);
68  ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1)));
69  ASSERT_TRUE(KeysMatch(0, 1));
70  ASSERT_EQ(1U, GetAllKeys(0).size());
71
72  // Client1 adds a key.
73  keys.clear();
74  keys.insert(AutofillKey("name1", "value1-0"));
75  AddKeys(1, keys);
76  MakeABookmarkChange(1);
77  ASSERT_TRUE(GetClient(1)->AwaitMutualSyncCycleCompletion(GetClient(0)));
78  ASSERT_TRUE(KeysMatch(0, 1));
79  ASSERT_EQ(2U, GetAllKeys(0).size());
80
81  // Client0 adds a key with the same name.
82  keys.clear();
83  keys.insert(AutofillKey("name1", "value1-1"));
84  AddKeys(0, keys);
85  MakeABookmarkChange(0);
86  ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1)));
87  ASSERT_TRUE(KeysMatch(0, 1));
88  ASSERT_EQ(3U, GetAllKeys(0).size());
89
90  // Client1 removes a key.
91  RemoveKey(1, AutofillKey("name1", "value1-0"));
92  MakeABookmarkChange(1);
93  ASSERT_TRUE(GetClient(1)->AwaitMutualSyncCycleCompletion(GetClient(0)));
94  ASSERT_TRUE(KeysMatch(0, 1));
95  ASSERT_EQ(2U, GetAllKeys(0).size());
96
97  // Client0 removes the rest.
98  RemoveKey(0, AutofillKey("name0", "value0"));
99  RemoveKey(0, AutofillKey("name1", "value1-1"));
100  MakeABookmarkChange(0);
101  ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1)));
102  ASSERT_TRUE(KeysMatch(0, 1));
103  ASSERT_EQ(0U, GetAllKeys(0).size());
104}
105
106// TCM ID - 3678296.
107IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, AddUnicodeProfile) {
108  ASSERT_TRUE(SetupClients()) << "SetupClients() failed.";
109
110  std::set<AutofillKey> keys;
111  keys.insert(AutofillKey(WideToUTF16(L"Sigur R\u00F3s"),
112                          WideToUTF16(L"\u00C1g\u00E6tis byrjun")));
113  AddKeys(0, keys);
114  ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
115  ASSERT_TRUE(AwaitQuiescence());
116  ASSERT_TRUE(KeysMatch(0, 1));
117}
118
119IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest,
120                       AddDuplicateNamesToSameProfile) {
121  ASSERT_TRUE(SetupClients()) << "SetupClients() failed.";
122
123  std::set<AutofillKey> keys;
124  keys.insert(AutofillKey("name0", "value0-0"));
125  keys.insert(AutofillKey("name0", "value0-1"));
126  keys.insert(AutofillKey("name1", "value1"));
127  AddKeys(0, keys);
128  ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
129  ASSERT_TRUE(AwaitQuiescence());
130  ASSERT_TRUE(KeysMatch(0, 1));
131  ASSERT_EQ(2U, GetAllKeys(0).size());
132}
133
134IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest,
135                       AddDuplicateNamesToDifferentProfiles) {
136  ASSERT_TRUE(SetupClients()) << "SetupClients() failed.";
137
138  std::set<AutofillKey> keys0;
139  keys0.insert(AutofillKey("name0", "value0-0"));
140  keys0.insert(AutofillKey("name1", "value1"));
141  AddKeys(0, keys0);
142
143  std::set<AutofillKey> keys1;
144  keys1.insert(AutofillKey("name0", "value0-1"));
145  keys1.insert(AutofillKey("name2", "value2"));
146  keys1.insert(AutofillKey("name3", "value3"));
147  AddKeys(1, keys1);
148
149  ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
150  ASSERT_TRUE(AwaitQuiescence());
151  ASSERT_TRUE(KeysMatch(0, 1));
152  ASSERT_EQ(5U, GetAllKeys(0).size());
153}
154
155IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest,
156                       PersonalDataManagerSanity) {
157  ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
158
159  // Client0 adds a profile.
160  AddProfile(0, CreateAutofillProfile(PROFILE_HOMER));
161  MakeABookmarkChange(0);
162  ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1)));
163  ASSERT_TRUE(ProfilesMatch(0, 1));
164  ASSERT_EQ(1U, GetAllProfiles(0).size());
165
166  // Client1 adds a profile.
167  AddProfile(1, CreateAutofillProfile(PROFILE_MARION));
168  MakeABookmarkChange(1);
169  ASSERT_TRUE(GetClient(1)->AwaitMutualSyncCycleCompletion(GetClient(0)));
170  ASSERT_TRUE(ProfilesMatch(0, 1));
171  ASSERT_EQ(2U, GetAllProfiles(0).size());
172
173  // Client0 adds the same profile.
174  AddProfile(0, CreateAutofillProfile(PROFILE_MARION));
175  MakeABookmarkChange(0);
176  ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1)));
177  ASSERT_TRUE(ProfilesMatch(0, 1));
178  ASSERT_EQ(2U, GetAllProfiles(0).size());
179
180  // Client1 removes a profile.
181  RemoveProfile(1, GetAllProfiles(1)[0]->guid());
182  MakeABookmarkChange(1);
183  ASSERT_TRUE(GetClient(1)->AwaitMutualSyncCycleCompletion(GetClient(0)));
184  ASSERT_TRUE(ProfilesMatch(0, 1));
185  ASSERT_EQ(1U, GetAllProfiles(0).size());
186
187  // Client0 updates a profile.
188  UpdateProfile(0,
189                GetAllProfiles(0)[0]->guid(),
190                AutofillType(autofill::NAME_FIRST),
191                ASCIIToUTF16("Bart"));
192  MakeABookmarkChange(0);
193  ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1)));
194  ASSERT_TRUE(ProfilesMatch(0, 1));
195  ASSERT_EQ(1U, GetAllProfiles(0).size());
196
197  // Client1 removes remaining profile.
198  RemoveProfile(1, GetAllProfiles(1)[0]->guid());
199  MakeABookmarkChange(1);
200  ASSERT_TRUE(GetClient(1)->AwaitMutualSyncCycleCompletion(GetClient(0)));
201  ASSERT_TRUE(ProfilesMatch(0, 1));
202  ASSERT_EQ(0U, GetAllProfiles(0).size());
203}
204
205// TCM ID - 7261786.
206IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, AddDuplicateProfiles) {
207  ASSERT_TRUE(SetupClients()) << "SetupClients() failed.";
208
209  AddProfile(0, CreateAutofillProfile(PROFILE_HOMER));
210  AddProfile(0, CreateAutofillProfile(PROFILE_HOMER));
211  ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
212  ASSERT_TRUE(AwaitQuiescence());
213  ASSERT_TRUE(ProfilesMatch(0, 1));
214  ASSERT_EQ(1U, GetAllProfiles(0).size());
215}
216
217// TCM ID - 3636294.
218IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, SameProfileWithConflict) {
219  ASSERT_TRUE(SetupClients()) << "SetupClients() failed.";
220
221  AutofillProfile profile0 = CreateAutofillProfile(PROFILE_HOMER);
222  AutofillProfile profile1 = CreateAutofillProfile(PROFILE_HOMER);
223  profile1.SetRawInfo(autofill::PHONE_HOME_WHOLE_NUMBER,
224                      ASCIIToUTF16("1234567890"));
225
226  AddProfile(0, profile0);
227  AddProfile(1, profile1);
228  ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
229  ASSERT_TRUE(AwaitQuiescence());
230  ASSERT_TRUE(ProfilesMatch(0, 1));
231  ASSERT_EQ(1U, GetAllProfiles(0).size());
232}
233
234// TCM ID - 3626291.
235IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, AddEmptyProfile) {
236  ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
237
238  AddProfile(0, CreateAutofillProfile(PROFILE_NULL));
239  ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1)));
240  ASSERT_TRUE(ProfilesMatch(0, 1));
241  ASSERT_EQ(0U, GetAllProfiles(0).size());
242}
243
244// TCM ID - 3616283.
245IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, AddProfile) {
246  ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
247
248  AddProfile(0, CreateAutofillProfile(PROFILE_HOMER));
249  MakeABookmarkChange(0);
250  ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1)));
251  ASSERT_TRUE(ProfilesMatch(0, 1));
252  ASSERT_EQ(1U, GetAllProfiles(0).size());
253}
254
255// TCM ID - 3632260.
256IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, AddMultipleProfiles) {
257  ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
258
259  AddProfile(0, CreateAutofillProfile(PROFILE_HOMER));
260  AddProfile(0, CreateAutofillProfile(PROFILE_MARION));
261  AddProfile(0, CreateAutofillProfile(PROFILE_FRASIER));
262  MakeABookmarkChange(0);
263  ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1)));
264  ASSERT_TRUE(ProfilesMatch(0, 1));
265  ASSERT_EQ(3U, GetAllProfiles(0).size());
266}
267
268// TCM ID - 3602257.
269IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, DeleteProfile) {
270  ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
271
272  AddProfile(0, CreateAutofillProfile(PROFILE_HOMER));
273  MakeABookmarkChange(0);
274  ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1)));
275  ASSERT_TRUE(ProfilesMatch(0, 1));
276  ASSERT_EQ(1U, GetAllProfiles(0).size());
277
278  RemoveProfile(1, GetAllProfiles(1)[0]->guid());
279  MakeABookmarkChange(1);
280  ASSERT_TRUE(GetClient(1)->AwaitMutualSyncCycleCompletion(GetClient(0)));
281  ASSERT_TRUE(ProfilesMatch(0, 1));
282  ASSERT_EQ(0U, GetAllProfiles(0).size());
283}
284
285// TCM ID - 3627300.
286IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, MergeProfiles) {
287  ASSERT_TRUE(SetupClients()) << "SetupClients() failed.";
288
289  AddProfile(0, CreateAutofillProfile(PROFILE_HOMER));
290  AddProfile(1, CreateAutofillProfile(PROFILE_MARION));
291  AddProfile(1, CreateAutofillProfile(PROFILE_FRASIER));
292  ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
293  ASSERT_TRUE(AwaitQuiescence());
294  ASSERT_TRUE(ProfilesMatch(0, 1));
295  ASSERT_EQ(3U, GetAllProfiles(0).size());
296}
297
298// TCM ID - 3665264.
299IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, UpdateFields) {
300  ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
301
302  AddProfile(0, CreateAutofillProfile(PROFILE_HOMER));
303  MakeABookmarkChange(0);
304  ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1)));
305  ASSERT_TRUE(ProfilesMatch(0, 1));
306  ASSERT_EQ(1U, GetAllProfiles(0).size());
307
308  UpdateProfile(0,
309                GetAllProfiles(0)[0]->guid(),
310                AutofillType(autofill::NAME_FIRST),
311                ASCIIToUTF16("Lisa"));
312  UpdateProfile(0,
313                GetAllProfiles(0)[0]->guid(),
314                AutofillType(autofill::EMAIL_ADDRESS),
315                ASCIIToUTF16("grrrl@TV.com"));
316  MakeABookmarkChange(0);
317  ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1)));
318  ASSERT_TRUE(ProfilesMatch(0, 1));
319  ASSERT_EQ(1U, GetAllProfiles(0).size());
320}
321
322// TCM ID - 3628299.
323// This test is flaky on all platforms.  See crbug.com/152551.
324IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, DISABLED_ConflictingFields) {
325  ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
326
327  AddProfile(0, CreateAutofillProfile(PROFILE_HOMER));
328  MakeABookmarkChange(0);
329  ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1)));
330  ASSERT_TRUE(ProfilesMatch(0, 1));
331  ASSERT_EQ(1U, GetAllProfiles(0).size());
332  UpdateProfile(0,
333                GetAllProfiles(0)[0]->guid(),
334                AutofillType(autofill::NAME_FIRST),
335                ASCIIToUTF16("Lisa"));
336  MakeABookmarkChange(0);
337  UpdateProfile(1,
338                GetAllProfiles(1)[0]->guid(),
339                AutofillType(autofill::NAME_FIRST),
340                ASCIIToUTF16("Bart"));
341  MakeABookmarkChange(1);
342  ASSERT_TRUE(AwaitQuiescence());
343  ASSERT_TRUE(ProfilesMatch(0, 1));
344  ASSERT_EQ(1U, GetAllProfiles(0).size());
345}
346
347// TCM ID - 3663293.
348IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, DisableAutofill) {
349  ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
350
351  AddProfile(0, CreateAutofillProfile(PROFILE_HOMER));
352  MakeABookmarkChange(0);
353  ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1)));
354  ASSERT_TRUE(ProfilesMatch(0, 1));
355  ASSERT_EQ(1U, GetAllProfiles(0).size());
356
357  ASSERT_TRUE(GetClient(0)->DisableSyncForDatatype(syncer::AUTOFILL));
358  AddProfile(0, CreateAutofillProfile(PROFILE_FRASIER));
359  MakeABookmarkChange(0);
360  ASSERT_TRUE(AwaitQuiescence());
361  ASSERT_FALSE(ProfilesMatch(0, 1));
362  ASSERT_EQ(2U, GetAllProfiles(0).size());
363  ASSERT_EQ(1U, GetAllProfiles(1).size());
364
365  ASSERT_TRUE(GetClient(0)->EnableSyncForDatatype(syncer::AUTOFILL));
366  MakeABookmarkChange(0);
367  ASSERT_TRUE(AwaitQuiescence());
368  ASSERT_TRUE(ProfilesMatch(0, 1));
369  ASSERT_EQ(2U, GetAllProfiles(0).size());
370}
371
372// TCM ID - 3661291.
373IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, DisableSync) {
374  ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
375
376  AddProfile(0, CreateAutofillProfile(PROFILE_HOMER));
377  MakeABookmarkChange(0);
378  ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1)));
379  ASSERT_TRUE(ProfilesMatch(0, 1));
380  ASSERT_EQ(1U, GetAllProfiles(0).size());
381
382  ASSERT_TRUE(GetClient(1)->DisableSyncForAllDatatypes());
383  AddProfile(0, CreateAutofillProfile(PROFILE_FRASIER));
384  MakeABookmarkChange(0);
385  ASSERT_TRUE(GetClient(0)->AwaitFullSyncCompletion("Added a profile."));
386  ASSERT_FALSE(ProfilesMatch(0, 1));
387  ASSERT_EQ(2U, GetAllProfiles(0).size());
388  ASSERT_EQ(1U, GetAllProfiles(1).size());
389
390  ASSERT_TRUE(GetClient(1)->EnableSyncForAllDatatypes());
391  ASSERT_TRUE(AwaitQuiescence());
392  ASSERT_TRUE(ProfilesMatch(0, 1));
393  ASSERT_EQ(2U, GetAllProfiles(0).size());
394}
395
396// TCM ID - 3608295.
397IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, MaxLength) {
398  ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
399
400  AddProfile(0, CreateAutofillProfile(PROFILE_HOMER));
401  MakeABookmarkChange(0);
402  ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1)));
403  ASSERT_TRUE(ProfilesMatch(0, 1));
404  ASSERT_EQ(1U, GetAllProfiles(0).size());
405
406  base::string16 max_length_string(AutofillTable::kMaxDataLength, '.');
407  UpdateProfile(0,
408                GetAllProfiles(0)[0]->guid(),
409                AutofillType(autofill::NAME_FIRST),
410                max_length_string);
411  UpdateProfile(0,
412                GetAllProfiles(0)[0]->guid(),
413                AutofillType(autofill::NAME_LAST),
414                max_length_string);
415  UpdateProfile(0,
416                GetAllProfiles(0)[0]->guid(),
417                AutofillType(autofill::EMAIL_ADDRESS),
418                max_length_string);
419  UpdateProfile(0,
420                GetAllProfiles(0)[0]->guid(),
421                AutofillType(autofill::ADDRESS_HOME_LINE1),
422                max_length_string);
423
424  MakeABookmarkChange(0);
425  ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1)));
426  ASSERT_TRUE(ProfilesMatch(0, 1));
427}
428
429IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, ExceedsMaxLength) {
430  ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
431
432  AddProfile(0, CreateAutofillProfile(PROFILE_HOMER));
433  MakeABookmarkChange(0);
434  ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1)));
435  ASSERT_TRUE(ProfilesMatch(0, 1));
436  ASSERT_EQ(1U, GetAllProfiles(0).size());
437
438  base::string16 exceeds_max_length_string(
439      AutofillTable::kMaxDataLength + 1, '.');
440  UpdateProfile(0,
441                GetAllProfiles(0)[0]->guid(),
442                AutofillType(autofill::NAME_FIRST),
443                exceeds_max_length_string);
444  UpdateProfile(0,
445                GetAllProfiles(0)[0]->guid(),
446                AutofillType(autofill::NAME_LAST),
447                exceeds_max_length_string);
448  UpdateProfile(0,
449                GetAllProfiles(0)[0]->guid(),
450                AutofillType(autofill::EMAIL_ADDRESS),
451                exceeds_max_length_string);
452  UpdateProfile(0,
453                GetAllProfiles(0)[0]->guid(),
454                AutofillType(autofill::ADDRESS_HOME_LINE1),
455                exceeds_max_length_string);
456
457  MakeABookmarkChange(0);
458  ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1)));
459  ASSERT_FALSE(ProfilesMatch(0, 1));
460}
461
462// Test credit cards don't sync.
463IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, NoCreditCardSync) {
464  ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
465
466  AddProfile(0, CreateAutofillProfile(PROFILE_HOMER));
467
468  CreditCard card;
469  card.SetRawInfo(autofill::CREDIT_CARD_NUMBER,
470                  ASCIIToUTF16("6011111111111117"));
471  std::vector<CreditCard> credit_cards;
472  credit_cards.push_back(card);
473  SetCreditCards(0, &credit_cards);
474
475  MakeABookmarkChange(0);
476  ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1)));
477  ASSERT_TRUE(ProfilesMatch(0, 1));
478  ASSERT_EQ(1U, GetAllProfiles(0).size());
479
480  PersonalDataManager* pdm = GetPersonalDataManager(1);
481  ASSERT_EQ(0U, pdm->GetCreditCards().size());
482}
483