Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/browser/autofill/autofill_profile.h" | 6 #include "chrome/browser/autofill/autofill_profile.h" |
| 7 #include "chrome/browser/sync/profile_sync_service_harness.h" | 7 #include "chrome/browser/sync/profile_sync_service_harness.h" |
| 8 #include "chrome/browser/sync/test/integration/autofill_helper.h" | 8 #include "chrome/browser/sync/test/integration/autofill_helper.h" |
| 9 #include "chrome/browser/sync/test/integration/bookmarks_helper.h" | |
| 9 #include "chrome/browser/sync/test/integration/sync_test.h" | 10 #include "chrome/browser/sync/test/integration/sync_test.h" |
| 10 #include "chrome/browser/webdata/autofill_entry.h" | 11 #include "chrome/browser/webdata/autofill_entry.h" |
| 11 #include "chrome/browser/webdata/autofill_table.h" | 12 #include "chrome/browser/webdata/autofill_table.h" |
| 12 | 13 |
| 13 using autofill_helper::AddKeys; | 14 using autofill_helper::AddKeys; |
| 14 using autofill_helper::AddProfile; | 15 using autofill_helper::AddProfile; |
| 15 using autofill_helper::CreateAutofillProfile; | 16 using autofill_helper::CreateAutofillProfile; |
| 16 using autofill_helper::GetAllKeys; | 17 using autofill_helper::GetAllKeys; |
| 17 using autofill_helper::GetAllProfiles; | 18 using autofill_helper::GetAllProfiles; |
| 18 using autofill_helper::KeysMatch; | 19 using autofill_helper::KeysMatch; |
| 19 using autofill_helper::ProfilesMatch; | 20 using autofill_helper::ProfilesMatch; |
| 20 using autofill_helper::PROFILE_FRASIER; | 21 using autofill_helper::PROFILE_FRASIER; |
| 21 using autofill_helper::PROFILE_HOMER; | 22 using autofill_helper::PROFILE_HOMER; |
| 22 using autofill_helper::PROFILE_MARION; | 23 using autofill_helper::PROFILE_MARION; |
| 23 using autofill_helper::PROFILE_NULL; | 24 using autofill_helper::PROFILE_NULL; |
| 24 using autofill_helper::RemoveKey; | 25 using autofill_helper::RemoveKey; |
| 25 using autofill_helper::RemoveProfile; | 26 using autofill_helper::RemoveProfile; |
| 26 using autofill_helper::UpdateProfile; | 27 using autofill_helper::UpdateProfile; |
| 28 using bookmarks_helper::AddURL; | |
| 29 using bookmarks_helper::IndexedURL; | |
| 30 using bookmarks_helper::IndexedURLTitle; | |
| 27 | 31 |
| 28 class TwoClientAutofillSyncTest : public SyncTest { | 32 class TwoClientAutofillSyncTest : public SyncTest { |
| 29 public: | 33 public: |
| 30 TwoClientAutofillSyncTest() : SyncTest(TWO_CLIENT) {} | 34 TwoClientAutofillSyncTest() : SyncTest(TWO_CLIENT) { count = 0; } |
| 31 virtual ~TwoClientAutofillSyncTest() {} | 35 virtual ~TwoClientAutofillSyncTest() {} |
| 32 | 36 |
| 37 // We do this so as to make a change that will trigger the autofill to sync. | |
| 38 // By default autofill does not sync unless there is some other change. | |
| 39 void MakeABookmarkChange(int profile) { | |
| 40 AddURL(profile, IndexedURLTitle(count), GURL(IndexedURL(count))); | |
| 41 ++count; | |
| 42 } | |
|
Raghu Simha
2011/12/19 21:01:58
nit: fix indent.
| |
| 33 private: | 43 private: |
| 44 int count; | |
| 34 DISALLOW_COPY_AND_ASSIGN(TwoClientAutofillSyncTest); | 45 DISALLOW_COPY_AND_ASSIGN(TwoClientAutofillSyncTest); |
| 35 }; | 46 }; |
| 36 | 47 |
| 37 // Flaky, http://crbug.com/102687 | 48 // Flaky, http://crbug.com/102687 |
| 38 IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, FLAKY_WebDataServiceSanity) { | 49 IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, FLAKY_WebDataServiceSanity) { |
| 39 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; | 50 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; |
| 40 | 51 |
| 41 // Client0 adds a key. | 52 // Client0 adds a key. |
| 42 std::set<AutofillKey> keys; | 53 std::set<AutofillKey> keys; |
| 43 keys.insert(AutofillKey("name0", "value0")); | 54 keys.insert(AutofillKey("name0", "value0")); |
| (...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 397 AutofillType(EMAIL_ADDRESS), | 408 AutofillType(EMAIL_ADDRESS), |
| 398 exceeds_max_length_string); | 409 exceeds_max_length_string); |
| 399 UpdateProfile(0, | 410 UpdateProfile(0, |
| 400 GetAllProfiles(0)[0]->guid(), | 411 GetAllProfiles(0)[0]->guid(), |
| 401 AutofillType(ADDRESS_HOME_LINE1), | 412 AutofillType(ADDRESS_HOME_LINE1), |
| 402 exceeds_max_length_string); | 413 exceeds_max_length_string); |
| 403 | 414 |
| 404 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); | 415 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); |
| 405 ASSERT_FALSE(ProfilesMatch(0, 1)); | 416 ASSERT_FALSE(ProfilesMatch(0, 1)); |
| 406 } | 417 } |
| OLD | NEW |