OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "base/utf_string_conversions.h" | 5 #include "base/utf_string_conversions.h" |
6 #include "chrome/test/live_sync/live_autofill_sync_test.h" | 6 #include "chrome/test/live_sync/live_autofill_sync_test.h" |
7 | 7 |
8 // TODO(rsimha): Remove FAILS prefix after crbug.com/51956 is fixed. | 8 IN_PROC_BROWSER_TEST_F(TwoClientLiveAutofillSyncTest, Client1HasData) { |
9 IN_PROC_BROWSER_TEST_F(TwoClientLiveAutofillSyncTest, | |
10 FAILS_Client1HasData) { | |
11 ASSERT_TRUE(SetupClients()) << "SetupClients() failed."; | 9 ASSERT_TRUE(SetupClients()) << "SetupClients() failed."; |
12 | 10 |
13 AutofillKeys keys; | 11 AutofillKeys keys; |
14 keys.insert(AutofillKey("name0", "value0")); | 12 keys.insert(AutofillKey("name0", "value0")); |
15 keys.insert(AutofillKey("name0", "value1")); | 13 keys.insert(AutofillKey("name0", "value1")); |
16 keys.insert(AutofillKey("name1", "value2")); | 14 keys.insert(AutofillKey("name1", "value2")); |
17 keys.insert(AutofillKey(WideToUTF16(L"Sigur R\u00F3s"), | 15 keys.insert(AutofillKey(WideToUTF16(L"Sigur R\u00F3s"), |
18 WideToUTF16(L"\u00C1g\u00E6tis byrjun"))); | 16 WideToUTF16(L"\u00C1g\u00E6tis byrjun"))); |
19 AddFormFieldsToWebData(GetWebDataService(0), keys); | 17 AddFormFieldsToWebData(GetWebDataService(0), keys); |
20 | 18 |
21 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; | 19 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; |
22 ASSERT_TRUE(ProfileSyncServiceTestHarness::AwaitQuiescence(clients())); | 20 ASSERT_TRUE(ProfileSyncServiceTestHarness::AwaitQuiescence(clients())); |
23 | 21 |
24 AutofillKeys wd1_keys; | 22 AutofillKeys wd1_keys; |
25 GetAllAutofillKeys(GetWebDataService(1), &wd1_keys); | 23 GetAllAutofillKeys(GetWebDataService(1), &wd1_keys); |
26 EXPECT_EQ(keys, wd1_keys); | 24 |
| 25 // Note: In this test, name0-value0 and name0-value1 were both added in the |
| 26 // same transaction on Client0. However, only the first entry with name0 is |
| 27 // added, due to changes made in r55781. See crbug.com/51727. |
| 28 AutofillKeys expected_keys; |
| 29 expected_keys.insert(AutofillKey("name0", "value0")); |
| 30 expected_keys.insert(AutofillKey("name1", "value2")); |
| 31 expected_keys.insert(AutofillKey(WideToUTF16(L"Sigur R\u00F3s"), |
| 32 WideToUTF16(L"\u00C1g\u00E6tis byrjun"))); |
| 33 EXPECT_EQ(expected_keys, wd1_keys); |
27 } | 34 } |
28 | 35 |
29 IN_PROC_BROWSER_TEST_F(TwoClientLiveAutofillSyncTest, BothHaveData) { | 36 IN_PROC_BROWSER_TEST_F(TwoClientLiveAutofillSyncTest, BothHaveData) { |
30 ASSERT_TRUE(SetupClients()) << "SetupClients() failed."; | 37 ASSERT_TRUE(SetupClients()) << "SetupClients() failed."; |
31 | 38 |
32 AutofillKeys keys1; | 39 AutofillKeys keys1; |
33 keys1.insert(AutofillKey("name0", "value0")); | 40 keys1.insert(AutofillKey("name0", "value0")); |
34 keys1.insert(AutofillKey("name0", "value1")); | |
35 keys1.insert(AutofillKey("name1", "value2")); | 41 keys1.insert(AutofillKey("name1", "value2")); |
36 AddFormFieldsToWebData(GetWebDataService(0), keys1); | 42 AddFormFieldsToWebData(GetWebDataService(0), keys1); |
37 | 43 |
38 AutofillKeys keys2; | 44 AutofillKeys keys2; |
39 keys2.insert(AutofillKey("name0", "value1")); | 45 keys2.insert(AutofillKey("name0", "value1")); |
40 keys2.insert(AutofillKey("name1", "value2")); | |
41 keys2.insert(AutofillKey("name2", "value3")); | 46 keys2.insert(AutofillKey("name2", "value3")); |
42 keys2.insert(AutofillKey("name3", "value3")); | 47 keys2.insert(AutofillKey("name3", "value3")); |
43 AddFormFieldsToWebData(GetWebDataService(1), keys2); | 48 AddFormFieldsToWebData(GetWebDataService(1), keys2); |
44 | 49 |
45 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; | 50 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; |
46 EXPECT_TRUE(ProfileSyncServiceTestHarness::AwaitQuiescence(clients())); | 51 EXPECT_TRUE(ProfileSyncServiceTestHarness::AwaitQuiescence(clients())); |
47 | 52 |
| 53 // Note: In this test, name0-value0 and name0-value1 were added in separate |
| 54 // transactions -- one on Client0 and the other on Client1. Therefore, we |
| 55 // expect to see both pairs once sync completes and the lists are merged. |
48 AutofillKeys expected_keys; | 56 AutofillKeys expected_keys; |
49 expected_keys.insert(AutofillKey("name0", "value0")); | 57 expected_keys.insert(AutofillKey("name0", "value0")); |
50 expected_keys.insert(AutofillKey("name0", "value1")); | 58 expected_keys.insert(AutofillKey("name0", "value1")); |
51 expected_keys.insert(AutofillKey("name1", "value2")); | 59 expected_keys.insert(AutofillKey("name1", "value2")); |
52 expected_keys.insert(AutofillKey("name2", "value3")); | 60 expected_keys.insert(AutofillKey("name2", "value3")); |
53 expected_keys.insert(AutofillKey("name3", "value3")); | 61 expected_keys.insert(AutofillKey("name3", "value3")); |
54 | 62 |
55 AutofillKeys wd0_keys; | 63 AutofillKeys wd0_keys; |
56 GetAllAutofillKeys(GetWebDataService(0), &wd0_keys); | 64 GetAllAutofillKeys(GetWebDataService(0), &wd0_keys); |
57 EXPECT_EQ(expected_keys, wd0_keys); | 65 EXPECT_EQ(expected_keys, wd0_keys); |
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
279 STLDeleteElements(&expected_profiles); | 287 STLDeleteElements(&expected_profiles); |
280 RemoveProfile(GetPersonalDataManager(1), ASCIIToUTF16("Billing")); | 288 RemoveProfile(GetPersonalDataManager(1), ASCIIToUTF16("Billing")); |
281 RemoveProfile(GetPersonalDataManager(1), ASCIIToUTF16("Billing2")); | 289 RemoveProfile(GetPersonalDataManager(1), ASCIIToUTF16("Billing2")); |
282 EXPECT_TRUE(GetClient(1)->AwaitMutualSyncCycleCompletion(GetClient(0))); | 290 EXPECT_TRUE(GetClient(1)->AwaitMutualSyncCycleCompletion(GetClient(0))); |
283 | 291 |
284 EXPECT_TRUE(CompareAutoFillProfiles(expected_profiles, | 292 EXPECT_TRUE(CompareAutoFillProfiles(expected_profiles, |
285 GetAllAutoFillProfiles(GetPersonalDataManager(0)))); | 293 GetAllAutoFillProfiles(GetPersonalDataManager(0)))); |
286 EXPECT_TRUE(CompareAutoFillProfiles(expected_profiles, | 294 EXPECT_TRUE(CompareAutoFillProfiles(expected_profiles, |
287 GetAllAutoFillProfiles(GetPersonalDataManager(1)))); | 295 GetAllAutoFillProfiles(GetPersonalDataManager(1)))); |
288 } | 296 } |
OLD | NEW |