| 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 <memory> |
| 10 #include <string> | 10 #include <string> |
| 11 | 11 |
| 12 #include "base/strings/string16.h" | 12 #include "base/strings/string16.h" |
| 13 #include "chrome/browser/sync/test/integration/await_match_status_change_checker
.h" |
| 13 | 14 |
| 14 class Profile; | 15 class Profile; |
| 15 class TemplateURL; | 16 class TemplateURL; |
| 16 class TemplateURLService; | 17 class TemplateURLService; |
| 17 | 18 |
| 18 typedef std::map<std::string, const TemplateURL*> GUIDToTURLMap; | 19 typedef std::map<std::string, const TemplateURL*> GUIDToTURLMap; |
| 19 | 20 |
| 20 namespace search_engines_helper { | 21 namespace search_engines_helper { |
| 21 | 22 |
| 22 // Used to access the search engines within a particular sync profile. | 23 // Used to access the search engines within a particular sync profile. |
| 23 TemplateURLService* GetServiceForBrowserContext(int profile_index); | 24 TemplateURLService* GetServiceForBrowserContext(int profile_index); |
| 24 | 25 |
| 25 // Used to access the search engines within the verifier sync profile. | 26 // Used to access the search engines within the verifier sync profile. |
| 26 TemplateURLService* GetVerifierService(); | 27 TemplateURLService* GetVerifierService(); |
| 27 | 28 |
| 28 // Compared a single TemplateURLService for a given profile to the verifier. | 29 // Compared a single TemplateURLService for a given profile to the verifier. |
| 29 // Retrns true iff their user-visible fields match. | 30 // Retrns true iff their user-visible fields match. |
| 30 bool ServiceMatchesVerifier(int profile_index); | 31 bool ServiceMatchesVerifier(int profile_index); |
| 31 | 32 |
| 32 // Blocks until either AllServicesMatch returns true or a timeout occurs. | |
| 33 // Returns true if AllServicesMatch succeeded, false if timeout. | |
| 34 bool AwaitAllServicesMatch(); | |
| 35 | |
| 36 // Returns true iff all TemplateURLServices match with the verifier. | 33 // Returns true iff all TemplateURLServices match with the verifier. |
| 37 bool AllServicesMatch(); | 34 bool AllServicesMatch(); |
| 38 | 35 |
| 39 // Create a TemplateURL with some test values based on |seed|. | 36 // Create a TemplateURL with some test values based on |seed|. |
| 40 std::unique_ptr<TemplateURL> CreateTestTemplateURL( | 37 std::unique_ptr<TemplateURL> CreateTestTemplateURL( |
| 41 Profile* profile, | 38 Profile* profile, |
| 42 int seed, | 39 int seed, |
| 43 const base::string16& keyword, | 40 const base::string16& keyword, |
| 44 const std::string& sync_guid); | 41 const std::string& sync_guid); |
| 45 std::unique_ptr<TemplateURL> CreateTestTemplateURL( | 42 std::unique_ptr<TemplateURL> CreateTestTemplateURL( |
| (...skipping 24 matching lines...) Expand all Loading... |
| 70 // |profile_index| to be the new default. Does the same to the verifier, if it | 67 // |profile_index| to be the new default. Does the same to the verifier, if it |
| 71 // is used. | 68 // is used. |
| 72 void ChangeDefaultSearchProvider(int profile_index, int seed); | 69 void ChangeDefaultSearchProvider(int profile_index, int seed); |
| 73 | 70 |
| 74 // Returns true if the profile at |profile_index| has a search engine matching | 71 // Returns true if the profile at |profile_index| has a search engine matching |
| 75 // the search engine generated with |seed|. | 72 // the search engine generated with |seed|. |
| 76 bool HasSearchEngine(int profile_index, int seed); | 73 bool HasSearchEngine(int profile_index, int seed); |
| 77 | 74 |
| 78 } // namespace search_engines_helper | 75 } // namespace search_engines_helper |
| 79 | 76 |
| 77 // Checker that blocks until all services have the same search engine data. |
| 78 class SearchEnginesMatchChecker : public AwaitMatchStatusChangeChecker { |
| 79 public: |
| 80 SearchEnginesMatchChecker(); |
| 81 }; |
| 82 |
| 80 #endif // CHROME_BROWSER_SYNC_TEST_INTEGRATION_SEARCH_ENGINES_HELPER_H_ | 83 #endif // CHROME_BROWSER_SYNC_TEST_INTEGRATION_SEARCH_ENGINES_HELPER_H_ |
| OLD | NEW |