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

Unified Diff: chrome/browser/search_engines/template_url_service_test_util.h

Issue 376413002: Stop using TemplateURLServiceTestUtil to initialize TemplateURLServiceFactory (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix TemplateURLServiceWithoutFallbackTest Created 6 years, 5 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 side-by-side diff with in-line comments
Download patch
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..c05c20d3a370d36c7b00d020914712a99db45c80 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,11 @@ 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();
-
- void CreateTemplateUrlService();
+ TemplateURLServiceTestUtil();
+ virtual ~TemplateURLServiceTestUtil();
// TemplateURLServiceObserver implemementation.
virtual void OnTemplateURLServiceChanged() OVERRIDE;
@@ -59,7 +52,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 +73,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);
};

Powered by Google App Engine
This is Rietveld 408576698