| 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_BROWSER_SYNC_TEST_LIVE_SYNC_AUTOFILL_HELPER_H_ | |
| 6 #define CHROME_BROWSER_SYNC_TEST_LIVE_SYNC_AUTOFILL_HELPER_H_ | |
| 7 #pragma once | |
| 8 | |
| 9 #include <set> | |
| 10 #include <string> | |
| 11 #include <vector> | |
| 12 | |
| 13 #include "base/compiler_specific.h" | |
| 14 #include "base/string16.h" | |
| 15 #include "chrome/browser/sync/test/live_sync/sync_datatype_helper.h" | |
| 16 | |
| 17 class AutofillEntry; | |
| 18 class AutofillKey; | |
| 19 class AutofillProfile; | |
| 20 class AutofillType; | |
| 21 class PersonalDataManager; | |
| 22 class WebDataService; | |
| 23 | |
| 24 namespace autofill_helper { | |
| 25 | |
| 26 enum ProfileType { | |
| 27 PROFILE_MARION, | |
| 28 PROFILE_HOMER, | |
| 29 PROFILE_FRASIER, | |
| 30 PROFILE_NULL | |
| 31 }; | |
| 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 | |
| 43 // Removes the form field in |key| from the WebDataService of sync profile | |
| 44 // |profile|. | |
| 45 void RemoveKey(int profile, const AutofillKey& key); | |
| 46 | |
| 47 // Gets all the form fields in the WebDataService of sync profile |profile|. | |
| 48 std::set<AutofillEntry> GetAllKeys(int profile) WARN_UNUSED_RESULT; | |
| 49 | |
| 50 // Compares the form fields in the WebDataServices of sync profiles | |
| 51 // |profile_a| and |profile_b|. Returns true if they match. | |
| 52 bool KeysMatch(int profile_a, int profile_b) WARN_UNUSED_RESULT; | |
| 53 | |
| 54 // Replaces the Autofill profiles in sync profile |profile| with | |
| 55 // |autofill_profiles|. | |
| 56 void SetProfiles(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( | |
| 75 int profile) WARN_UNUSED_RESULT; | |
| 76 | |
| 77 // Returns the number of autofill profiles contained by sync profile | |
| 78 // |profile|. | |
| 79 int GetProfileCount(int profile); | |
| 80 | |
| 81 // Returns the number of autofill keys contained by sync profile |profile|. | |
| 82 int GetKeyCount(int profile); | |
| 83 | |
| 84 // Compares the Autofill profiles in the PersonalDataManagers of sync profiles | |
| 85 // |profile_a| and |profile_b|. Returns true if they match. | |
| 86 bool ProfilesMatch(int profile_a, int profile_b) WARN_UNUSED_RESULT; | |
| 87 | |
| 88 // Compares the autofill profiles for all sync profiles, and returns true if | |
| 89 // they all match. | |
| 90 bool AllProfilesMatch() WARN_UNUSED_RESULT; | |
| 91 | |
| 92 // Creates a test autofill profile based on the persona specified in |type|. | |
| 93 AutofillProfile CreateAutofillProfile(ProfileType type); | |
| 94 | |
| 95 } // namespace autofill_helper | |
| 96 | |
| 97 #endif // CHROME_BROWSER_SYNC_TEST_LIVE_SYNC_AUTOFILL_HELPER_H_ | |
| OLD | NEW |