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

Side by Side Diff: chrome/browser/sync/test/integration/search_engines_helper.h

Issue 10173001: Add a Profile* member to TemplateURL. This makes some invocations of ReplaceSearchTerms() a bit le… (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 8 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_BROWSER_SYNC_TEST_INTEGRATION_SEARCH_ENGINES_HELPER_H_ 5 #ifndef CHROME_BROWSER_SYNC_TEST_INTEGRATION_SEARCH_ENGINES_HELPER_H_
6 #define CHROME_BROWSER_SYNC_TEST_INTEGRATION_SEARCH_ENGINES_HELPER_H_ 6 #define CHROME_BROWSER_SYNC_TEST_INTEGRATION_SEARCH_ENGINES_HELPER_H_
7 #pragma once 7 #pragma once
8 8
9 #include <map> 9 #include <map>
10 #include <string> 10 #include <string>
11 11
12 #include "base/string16.h" 12 #include "base/string16.h"
13 13
14 class Profile;
14 class TemplateURL; 15 class TemplateURL;
15 class TemplateURLService; 16 class TemplateURLService;
16 17
17 typedef std::map<std::string, const TemplateURL*> GUIDToTURLMap; 18 typedef std::map<std::string, const TemplateURL*> GUIDToTURLMap;
18 19
19 namespace search_engines_helper { 20 namespace search_engines_helper {
20 21
21 // Used to access the search engines within a particular sync profile. 22 // Used to access the search engines within a particular sync profile.
22 TemplateURLService* GetServiceForProfile(int index); 23 TemplateURLService* GetServiceForProfile(int profile_index);
23 24
24 // Used to access the search engines within the verifier sync profile. 25 // Used to access the search engines within the verifier sync profile.
25 TemplateURLService* GetVerifierService(); 26 TemplateURLService* GetVerifierService();
26 27
27 // Returns a mapping of |service|'s TemplateURL collection with their sync
28 // GUIDs as keys.
29 GUIDToTURLMap CreateGUIDToTURLMap(TemplateURLService* service);
30
31 // Returns true iff the major user-visible fields of |turl1| and |turl2| match.
32 bool TURLsMatch(const TemplateURL* turl1, const TemplateURL* turl2);
33
34 // Compared a single TemplateURLService for a given profile to the verifier. 28 // Compared a single TemplateURLService for a given profile to the verifier.
35 // Retrns true iff their user-visible fields match. 29 // Retrns true iff their user-visible fields match.
36 bool ServiceMatchesVerifier(int profile); 30 bool ServiceMatchesVerifier(int profile_index);
37
38 // Returns true iff |other|'s TemplateURLs matches the verifier's TemplateURLs
39 // by sync GUIDs and user-visible fields.
40 bool ServicesMatch(TemplateURLService* other);
41 31
42 // Returns true iff all TemplateURLServices match with the verifier. 32 // Returns true iff all TemplateURLServices match with the verifier.
43 bool AllServicesMatch(); 33 bool AllServicesMatch();
44 34
45 // Create a TemplateURL with some test values based on |seed|. The caller owns 35 // Create a TemplateURL with some test values based on |seed|. The caller owns
46 // the returned TemplateURL*. 36 // the returned TemplateURL*.
47 TemplateURL* CreateTestTemplateURL(int seed); 37 TemplateURL* CreateTestTemplateURL(Profile* profile,
48 TemplateURL* CreateTestTemplateURL(int seed, 38 int seed,
49 const string16& keyword, 39 const string16& keyword,
50 const std::string& sync_guid); 40 const std::string& sync_guid);
51 TemplateURL* CreateTestTemplateURL(int seed, 41 TemplateURL* CreateTestTemplateURL(Profile* profile,
42 int seed,
52 const string16& keyword, 43 const string16& keyword,
53 const std::string& url, 44 const std::string& url,
54 const std::string& sync_guid); 45 const std::string& sync_guid);
55 46
56 // Add a search engine based on a seed to the service at index |profile| and the 47 // Add a search engine based on a seed to the service at index |profile_index|
57 // verifier if it is used. 48 // and the verifier if it is used.
58 void AddSearchEngine(int profile, int seed); 49 void AddSearchEngine(int profile_index, int seed);
59 50
60 // Retrieves a search engine from the service at index |profile| with original 51 // Retrieves a search engine from the service at index |profile_index| with
61 // keyword |keyword| and changes its user-visible fields. Does the same to the 52 // original keyword |keyword| and changes its user-visible fields. Does the same
62 // verifier, if it is used. 53 // to the verifier, if it is used.
63 void EditSearchEngine(int profile, 54 void EditSearchEngine(int profile_index,
64 const string16& keyword, 55 const string16& keyword,
65 const string16& short_name, 56 const string16& short_name,
66 const string16& new_keyword, 57 const string16& new_keyword,
67 const std::string& url); 58 const std::string& url);
68 59
69 // Deletes a search engine from the service at index |profile| with original 60 // Deletes a search engine from the service at index |profile_index| which was
70 // keyword |keyword|. Does the same to the verifier, if it is used. 61 // generated by seed |seed|.
71 void DeleteSearchEngineByKeyword(int profile, const string16& keyword); 62 void DeleteSearchEngineBySeed(int profile_index, int seed);
72 63
73 // Deletes a search engine from the service at index |profile| which was 64 // Change the search engine generated with |seed| in service at index
74 // generated by seed |seed|. 65 // |profile_index| to be the new default. Does the same to the verifier, if it
75 void DeleteSearchEngineBySeed(int profile, int seed); 66 // is used.
76 67 void ChangeDefaultSearchProvider(int profile_index, int seed);
77 // Change the search engine generated with |seed| in service at index |profile|
78 // to be the new default. Does the same to the verifier, if it is used.
79 void ChangeDefaultSearchProvider(int profile, int seed);
80 68
81 } // namespace search_engines_helper 69 } // namespace search_engines_helper
82 70
83 #endif // CHROME_BROWSER_SYNC_TEST_INTEGRATION_SEARCH_ENGINES_HELPER_H_ 71 #endif // CHROME_BROWSER_SYNC_TEST_INTEGRATION_SEARCH_ENGINES_HELPER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698