| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CHROME_TEST_LIVE_SYNC_LIVE_AUTOFILL_SYNC_TEST_H_ | |
| 6 #define CHROME_TEST_LIVE_SYNC_LIVE_AUTOFILL_SYNC_TEST_H_ | |
| 7 #pragma once | |
| 8 | |
| 9 #include <set> | |
| 10 #include <vector> | |
| 11 | |
| 12 #include "base/compiler_specific.h" | |
| 13 #include "chrome/browser/autofill/personal_data_manager.h" | |
| 14 #include "chrome/test/live_sync/live_sync_test.h" | |
| 15 | |
| 16 class AutofillEntry; | |
| 17 class AutofillKey; | |
| 18 class AutofillProfile; | |
| 19 class WebDataService; | |
| 20 | |
| 21 class LiveAutofillSyncTest : public LiveSyncTest { | |
| 22 public: | |
| 23 enum ProfileType { | |
| 24 PROFILE_MARION, | |
| 25 PROFILE_HOMER, | |
| 26 PROFILE_FRASIER, | |
| 27 PROFILE_NULL | |
| 28 }; | |
| 29 | |
| 30 explicit LiveAutofillSyncTest(TestType test_type); | |
| 31 virtual ~LiveAutofillSyncTest(); | |
| 32 | |
| 33 // Used to access the web data service within a particular sync profile. | |
| 34 WebDataService* GetWebDataService(int index) WARN_UNUSED_RESULT; | |
| 35 | |
| 36 // Used to access the personal data manager within a particular sync profile. | |
| 37 PersonalDataManager* GetPersonalDataManager(int index) WARN_UNUSED_RESULT; | |
| 38 | |
| 39 // Adds the form fields in |keys| to the WebDataService of sync profile | |
| 40 // |profile|. | |
| 41 void AddKeys(int profile, const std::set<AutofillKey>& keys); | |
| 42 // Removes the form field in |key| from the WebDataService of sync profile | |
| 43 // |profile|. | |
| 44 void RemoveKey(int profile, const AutofillKey& key); | |
| 45 | |
| 46 // Gets all the form fields in the WebDataService of sync profile |profile|. | |
| 47 std::set<AutofillEntry> GetAllKeys(int profile) WARN_UNUSED_RESULT; | |
| 48 | |
| 49 // Compares the form fields in the WebDataServices of sync profiles | |
| 50 // |profile_a| and |profile_b|. Returns true if they match. | |
| 51 bool KeysMatch(int profile_a, int profile_b) WARN_UNUSED_RESULT; | |
| 52 | |
| 53 // Replaces the Autofill profiles in sync profile |profile| with | |
| 54 // |autofill_profiles|. | |
| 55 void SetProfiles( | |
| 56 int profile, std::vector<AutofillProfile>* autofill_profiles); | |
| 57 | |
| 58 // Adds the autofill profile |autofill_profile| to sync profile |profile|. | |
| 59 void AddProfile(int profile, const AutofillProfile& autofill_profile); | |
| 60 | |
| 61 // Removes the autofill profile with guid |guid| from sync profile | |
| 62 // |profile|. | |
| 63 void RemoveProfile(int profile, const std::string& guid); | |
| 64 | |
| 65 // Updates the autofill profile with guid |guid| in sync profile |profile| | |
| 66 // to |type| and |value|. | |
| 67 void UpdateProfile(int profile, | |
| 68 const std::string& guid, | |
| 69 const AutofillType& type, | |
| 70 const string16& value); | |
| 71 | |
| 72 // Gets all the Autofill profiles in the PersonalDataManager of sync profile | |
| 73 // |profile|. | |
| 74 const std::vector<AutofillProfile*>& GetAllProfiles(int profile) | |
| 75 WARN_UNUSED_RESULT; | |
| 76 | |
| 77 // Returns the number of autofill profiles contained by sync profile | |
| 78 // |profile|. | |
| 79 int GetProfileCount(int profile); | |
| 80 | |
| 81 // Compares the Autofill profiles in the PersonalDataManagers of sync profiles | |
| 82 // |profile_a| and |profile_b|. Returns true if they match. | |
| 83 bool ProfilesMatch(int profile_a, int profile_b) WARN_UNUSED_RESULT; | |
| 84 | |
| 85 // Compares the autofill profiles for all sync profiles, and returns true if | |
| 86 // they all match. | |
| 87 bool AllProfilesMatch() WARN_UNUSED_RESULT; | |
| 88 | |
| 89 private: | |
| 90 DISALLOW_COPY_AND_ASSIGN(LiveAutofillSyncTest); | |
| 91 }; | |
| 92 | |
| 93 AutofillProfile CreateAutofillProfile(LiveAutofillSyncTest::ProfileType type); | |
| 94 | |
| 95 class TwoClientLiveAutofillSyncTest : public LiveAutofillSyncTest { | |
| 96 public: | |
| 97 TwoClientLiveAutofillSyncTest() : LiveAutofillSyncTest(TWO_CLIENT) {} | |
| 98 virtual ~TwoClientLiveAutofillSyncTest() {} | |
| 99 | |
| 100 private: | |
| 101 DISALLOW_COPY_AND_ASSIGN(TwoClientLiveAutofillSyncTest); | |
| 102 }; | |
| 103 | |
| 104 #endif // CHROME_TEST_LIVE_SYNC_LIVE_AUTOFILL_SYNC_TEST_H_ | |
| OLD | NEW |