| OLD | NEW |
| 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 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <memory> |
| 9 #include <string> | 10 #include <string> |
| 10 | 11 |
| 11 #include "base/strings/string16.h" | 12 #include "base/strings/string16.h" |
| 12 | 13 |
| 13 class Profile; | 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* GetServiceForBrowserContext(int profile_index); | 23 TemplateURLService* GetServiceForBrowserContext(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 // Compared a single TemplateURLService for a given profile to the verifier. | 28 // Compared a single TemplateURLService for a given profile to the verifier. |
| 28 // Retrns true iff their user-visible fields match. | 29 // Retrns true iff their user-visible fields match. |
| 29 bool ServiceMatchesVerifier(int profile_index); | 30 bool ServiceMatchesVerifier(int profile_index); |
| 30 | 31 |
| 31 // Blocks until either AllServicesMatch returns true or a timeout occurs. | 32 // Blocks until either AllServicesMatch returns true or a timeout occurs. |
| 32 // Returns true if AllServicesMatch succeeded, false if timeout. | 33 // Returns true if AllServicesMatch succeeded, false if timeout. |
| 33 bool AwaitAllServicesMatch(); | 34 bool AwaitAllServicesMatch(); |
| 34 | 35 |
| 35 // Returns true iff all TemplateURLServices match with the verifier. | 36 // Returns true iff all TemplateURLServices match with the verifier. |
| 36 bool AllServicesMatch(); | 37 bool AllServicesMatch(); |
| 37 | 38 |
| 38 // Create a TemplateURL with some test values based on |seed|. The caller owns | 39 // Create a TemplateURL with some test values based on |seed|. |
| 39 // the returned TemplateURL*. | 40 std::unique_ptr<TemplateURL> CreateTestTemplateURL( |
| 40 TemplateURL* CreateTestTemplateURL(Profile* profile, | 41 Profile* profile, |
| 41 int seed, | 42 int seed, |
| 42 const base::string16& keyword, | 43 const base::string16& keyword, |
| 43 const std::string& sync_guid); | 44 const std::string& sync_guid); |
| 44 TemplateURL* CreateTestTemplateURL(Profile* profile, | 45 std::unique_ptr<TemplateURL> CreateTestTemplateURL( |
| 45 int seed, | 46 Profile* profile, |
| 46 const base::string16& keyword, | 47 int seed, |
| 47 const std::string& url, | 48 const base::string16& keyword, |
| 48 const std::string& sync_guid); | 49 const std::string& url, |
| 50 const std::string& sync_guid); |
| 49 | 51 |
| 50 // Add a search engine based on a seed to the service at index |profile_index| | 52 // Add a search engine based on a seed to the service at index |profile_index| |
| 51 // and the verifier if it is used. | 53 // and the verifier if it is used. |
| 52 void AddSearchEngine(int profile_index, int seed); | 54 void AddSearchEngine(int profile_index, int seed); |
| 53 | 55 |
| 54 // Retrieves a search engine from the service at index |profile_index| with | 56 // Retrieves a search engine from the service at index |profile_index| with |
| 55 // original keyword |keyword| and changes its user-visible fields. Does the same | 57 // original keyword |keyword| and changes its user-visible fields. Does the same |
| 56 // to the verifier, if it is used. | 58 // to the verifier, if it is used. |
| 57 void EditSearchEngine(int profile_index, | 59 void EditSearchEngine(int profile_index, |
| 58 const base::string16& keyword, | 60 const base::string16& keyword, |
| (...skipping 10 matching lines...) Expand all Loading... |
| 69 // is used. | 71 // is used. |
| 70 void ChangeDefaultSearchProvider(int profile_index, int seed); | 72 void ChangeDefaultSearchProvider(int profile_index, int seed); |
| 71 | 73 |
| 72 // Returns true if the profile at |profile_index| has a search engine matching | 74 // Returns true if the profile at |profile_index| has a search engine matching |
| 73 // the search engine generated with |seed|. | 75 // the search engine generated with |seed|. |
| 74 bool HasSearchEngine(int profile_index, int seed); | 76 bool HasSearchEngine(int profile_index, int seed); |
| 75 | 77 |
| 76 } // namespace search_engines_helper | 78 } // namespace search_engines_helper |
| 77 | 79 |
| 78 #endif // CHROME_BROWSER_SYNC_TEST_INTEGRATION_SEARCH_ENGINES_HELPER_H_ | 80 #endif // CHROME_BROWSER_SYNC_TEST_INTEGRATION_SEARCH_ENGINES_HELPER_H_ |
| OLD | NEW |