Chromium Code Reviews| Index: chrome/browser/search_engines/template_url_service_test_util.h |
| diff --git a/chrome/browser/search_engines/template_url_service_test_util.h b/chrome/browser/search_engines/template_url_service_test_util.h |
| index 83f4fade3c5358b98fe33084610485defe79d318..5d86a51492b9968c1d87daa2fe42ac807510e9ae 100644 |
| --- a/chrome/browser/search_engines/template_url_service_test_util.h |
| +++ b/chrome/browser/search_engines/template_url_service_test_util.h |
| @@ -9,9 +9,7 @@ |
| #include "base/basictypes.h" |
| #include "base/files/scoped_temp_dir.h" |
| -#include "base/memory/ref_counted.h" |
| #include "base/memory/scoped_ptr.h" |
| -#include "base/message_loop/message_loop.h" |
| #include "base/strings/string16.h" |
| #include "components/search_engines/template_url_service_observer.h" |
| #include "content/public/test/test_browser_thread_bundle.h" |
| @@ -20,16 +18,19 @@ class GURL; |
| class TemplateURLService; |
| class TestingProfile; |
| class TestingTemplateURLService; |
| -class TestingProfile; |
| -// TemplateURLServiceTestUtilBase contains basic API to ease testing of |
| -// TemplateURLService. User should take care of the infrastructure separately. |
| -class TemplateURLServiceTestUtilBase : public TemplateURLServiceObserver { |
| +class TemplateURLServiceTestUtil : public TemplateURLServiceObserver { |
| public: |
| - TemplateURLServiceTestUtilBase(); |
| - virtual ~TemplateURLServiceTestUtilBase(); |
| + TemplateURLServiceTestUtil(); |
| + virtual ~TemplateURLServiceTestUtil(); |
| - void CreateTemplateUrlService(); |
| + // Sets up the data structures for this class (mirroring gtest standard |
| + // methods). |
| + void SetUp(); |
|
Peter Kasting
2014/07/15 18:48:58
Can these also be moved into the constructor/destr
hashimoto
2014/07/16 03:20:59
ASSERT_TRUE cannot be moved into the ctor so at le
Peter Kasting
2014/07/16 05:38:12
Shrug, you could just nuke the ASSERT_TRUE.
|
| + |
| + // Cleans up data structures for this class (mirroring gtest standard |
|
Peter Kasting
2014/07/15 18:48:58
Nit: Extra space
hashimoto
2014/07/16 03:20:59
Done.
|
| + // methods). |
| + void TearDown(); |
| // TemplateURLServiceObserver implemementation. |
| virtual void OnTemplateURLServiceChanged() OVERRIDE; |
| @@ -59,7 +60,7 @@ class TemplateURLServiceTestUtilBase : public TemplateURLServiceObserver { |
| base::string16 GetAndClearSearchTerm(); |
| // Set the google base url. |base_url| must be valid. |
| - void SetGoogleBaseURL(const GURL& base_url) const; |
| + void SetGoogleBaseURL(const GURL& base_url); |
| // Set the managed preferences for the default search provider and trigger |
| // notification. If |alternate_url| is empty, uses an empty list of alternate |
| @@ -80,41 +81,17 @@ class TemplateURLServiceTestUtilBase : public TemplateURLServiceObserver { |
| void RemoveManagedDefaultSearchPreferences(); |
| // Returns the TemplateURLService. |
| - TemplateURLService* model() const; |
| - |
| - // Returns the TestingProfile. |
| - virtual TestingProfile* profile() const = 0; |
| - |
| - private: |
| - int changed_count_; |
| - |
| - DISALLOW_COPY_AND_ASSIGN(TemplateURLServiceTestUtilBase); |
| -}; |
| - |
| -// TemplateURLServiceTestUtil sets up TestingProfile, TemplateURLService and |
| -// required threads. |
| -class TemplateURLServiceTestUtil : public TemplateURLServiceTestUtilBase { |
| - public: |
| - TemplateURLServiceTestUtil(); |
| - virtual ~TemplateURLServiceTestUtil(); |
| - |
| - // Sets up the data structures for this class (mirroring gtest standard |
| - // methods). |
| - void SetUp(); |
| - |
| - // Cleans up data structures for this class (mirroring gtest standard |
| - // methods). |
| - void TearDown(); |
| + TemplateURLService* model(); |
| // Returns the TestingProfile. |
| - virtual TestingProfile* profile() const OVERRIDE; |
| + TestingProfile* profile() { return profile_.get(); } |
| private: |
| - // Needed to make the DeleteOnUIThread trait of WebDataService work |
| - // properly. |
| content::TestBrowserThreadBundle thread_bundle_; |
| scoped_ptr<TestingProfile> profile_; |
| base::ScopedTempDir temp_dir_; |
| + int changed_count_; |
| + scoped_ptr<TestingTemplateURLService> model_; |
| DISALLOW_COPY_AND_ASSIGN(TemplateURLServiceTestUtil); |
| }; |