Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(158)

Side by Side Diff: chrome/test/live_sync/autofill_helper.h

Issue 7461109: Allow sync integration tests to operate on multiple datatypes: Typed Urls (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: CR feedback; rebase Created 9 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/chrome_tests.gypi ('k') | chrome/test/live_sync/autofill_helper.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #ifndef CHROME_TEST_LIVE_SYNC_AUTOFILL_HELPER_H_ 5 #ifndef CHROME_TEST_LIVE_SYNC_AUTOFILL_HELPER_H_
6 #define CHROME_TEST_LIVE_SYNC_AUTOFILL_HELPER_H_ 6 #define CHROME_TEST_LIVE_SYNC_AUTOFILL_HELPER_H_
7 #pragma once 7 #pragma once
8 8
9 #include <set> 9 #include <set>
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/compiler_specific.h" 12 #include "base/compiler_specific.h"
13 #include "chrome/browser/autofill/personal_data_manager.h" 13 #include "chrome/browser/autofill/personal_data_manager.h"
14 #include "chrome/test/live_sync/sync_datatype_helper.h"
15 14
16 class AutofillEntry; 15 class AutofillEntry;
17 class AutofillKey; 16 class AutofillKey;
18 class AutofillProfile; 17 class AutofillProfile;
19 class WebDataService; 18 class WebDataService;
20 19
21 class AutofillHelper : public SyncDatatypeHelper { 20 namespace autofill_helper {
22 public:
23 enum ProfileType {
24 PROFILE_MARION,
25 PROFILE_HOMER,
26 PROFILE_FRASIER,
27 PROFILE_NULL
28 };
29 21
30 // Used to access the web data service within a particular sync profile. 22 enum ProfileType {
31 static WebDataService* GetWebDataService(int index) WARN_UNUSED_RESULT; 23 PROFILE_MARION,
32 24 PROFILE_HOMER,
33 // Used to access the personal data manager within a particular sync profile. 25 PROFILE_FRASIER,
34 static PersonalDataManager* GetPersonalDataManager( 26 PROFILE_NULL
35 int index) WARN_UNUSED_RESULT;
36
37 // Adds the form fields in |keys| to the WebDataService of sync profile
38 // |profile|.
39 static void AddKeys(int profile, const std::set<AutofillKey>& keys);
40
41 // Removes the form field in |key| from the WebDataService of sync profile
42 // |profile|.
43 static void RemoveKey(int profile, const AutofillKey& key);
44
45 // Gets all the form fields in the WebDataService of sync profile |profile|.
46 static std::set<AutofillEntry> GetAllKeys(int profile) WARN_UNUSED_RESULT;
47
48 // Compares the form fields in the WebDataServices of sync profiles
49 // |profile_a| and |profile_b|. Returns true if they match.
50 static bool KeysMatch(int profile_a, int profile_b) WARN_UNUSED_RESULT;
51
52 // Replaces the Autofill profiles in sync profile |profile| with
53 // |autofill_profiles|.
54 static void SetProfiles(int profile,
55 std::vector<AutofillProfile>* autofill_profiles);
56
57 // Adds the autofill profile |autofill_profile| to sync profile |profile|.
58 static void AddProfile(int profile, const AutofillProfile& autofill_profile);
59
60 // Removes the autofill profile with guid |guid| from sync profile
61 // |profile|.
62 static void RemoveProfile(int profile, const std::string& guid);
63
64 // Updates the autofill profile with guid |guid| in sync profile |profile|
65 // to |type| and |value|.
66 static void UpdateProfile(int profile,
67 const std::string& guid,
68 const AutofillType& type,
69 const string16& value);
70
71 // Gets all the Autofill profiles in the PersonalDataManager of sync profile
72 // |profile|.
73 static const std::vector<AutofillProfile*>& GetAllProfiles(
74 int profile) WARN_UNUSED_RESULT;
75
76 // Returns the number of autofill profiles contained by sync profile
77 // |profile|.
78 static int GetProfileCount(int profile);
79
80 // Compares the Autofill profiles in the PersonalDataManagers of sync profiles
81 // |profile_a| and |profile_b|. Returns true if they match.
82 static bool ProfilesMatch(int profile_a, int profile_b) WARN_UNUSED_RESULT;
83
84 // Compares the autofill profiles for all sync profiles, and returns true if
85 // they all match.
86 static bool AllProfilesMatch() WARN_UNUSED_RESULT;
87
88 // Creates a test autofill profile based on the persona specified in |type|.
89 static AutofillProfile CreateAutofillProfile(ProfileType type);
90 protected:
91 AutofillHelper();
92 virtual ~AutofillHelper();
93
94 private:
95 DISALLOW_COPY_AND_ASSIGN(AutofillHelper);
96 }; 27 };
97 28
29 // Used to access the web data service within a particular sync profile.
30 WebDataService* GetWebDataService(int index) WARN_UNUSED_RESULT;
31
32 // Used to access the personal data manager within a particular sync profile.
33 PersonalDataManager* GetPersonalDataManager(int index) WARN_UNUSED_RESULT;
34
35 // Adds the form fields in |keys| to the WebDataService of sync profile
36 // |profile|.
37 void AddKeys(int profile, const std::set<AutofillKey>& keys);
38
39 // Removes the form field in |key| from the WebDataService of sync profile
40 // |profile|.
41 void RemoveKey(int profile, const AutofillKey& key);
42
43 // Gets all the form fields in the WebDataService of sync profile |profile|.
44 std::set<AutofillEntry> GetAllKeys(int profile) WARN_UNUSED_RESULT;
45
46 // Compares the form fields in the WebDataServices of sync profiles
47 // |profile_a| and |profile_b|. Returns true if they match.
48 bool KeysMatch(int profile_a, int profile_b) WARN_UNUSED_RESULT;
49
50 // Replaces the Autofill profiles in sync profile |profile| with
51 // |autofill_profiles|.
52 void SetProfiles(int profile, std::vector<AutofillProfile>* autofill_profiles);
53
54 // Adds the autofill profile |autofill_profile| to sync profile |profile|.
55 void AddProfile(int profile, const AutofillProfile& autofill_profile);
56
57 // Removes the autofill profile with guid |guid| from sync profile
58 // |profile|.
59 void RemoveProfile(int profile, const std::string& guid);
60
61 // Updates the autofill profile with guid |guid| in sync profile |profile|
62 // to |type| and |value|.
63 void UpdateProfile(int profile,
64 const std::string& guid,
65 const AutofillType& type,
66 const string16& value);
67
68 // Gets all the Autofill profiles in the PersonalDataManager of sync profile
69 // |profile|.
70 const std::vector<AutofillProfile*>& GetAllProfiles(
71 int profile) WARN_UNUSED_RESULT;
72
73 // Returns the number of autofill profiles contained by sync profile
74 // |profile|.
75 int GetProfileCount(int profile);
76
77 // Compares the Autofill profiles in the PersonalDataManagers of sync profiles
78 // |profile_a| and |profile_b|. Returns true if they match.
79 bool ProfilesMatch(int profile_a, int profile_b) WARN_UNUSED_RESULT;
80
81 // Compares the autofill profiles for all sync profiles, and returns true if
82 // they all match.
83 bool AllProfilesMatch() WARN_UNUSED_RESULT;
84
85 // Creates a test autofill profile based on the persona specified in |type|.
86 AutofillProfile CreateAutofillProfile(ProfileType type);
87
88 } // namespace autofill_helper
89
98 #endif // CHROME_TEST_LIVE_SYNC_AUTOFILL_HELPER_H_ 90 #endif // CHROME_TEST_LIVE_SYNC_AUTOFILL_HELPER_H_
OLDNEW
« no previous file with comments | « chrome/chrome_tests.gypi ('k') | chrome/test/live_sync/autofill_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698