| Index: chrome/browser/search_engines/template_url_service_factory_test_util.h
|
| diff --git a/chrome/browser/search_engines/template_url_service_test_util.h b/chrome/browser/search_engines/template_url_service_factory_test_util.h
|
| similarity index 26%
|
| copy from chrome/browser/search_engines/template_url_service_test_util.h
|
| copy to chrome/browser/search_engines/template_url_service_factory_test_util.h
|
| index 83f4fade3c5358b98fe33084610485defe79d318..d8fb48134497e5c51f57aec49f800c7ae4597527 100644
|
| --- a/chrome/browser/search_engines/template_url_service_test_util.h
|
| +++ b/chrome/browser/search_engines/template_url_service_factory_test_util.h
|
| @@ -1,66 +1,27 @@
|
| -// Copyright (c) 2012 The Chromium Authors. All rights reserved.
|
| +// Copyright 2014 The Chromium Authors. All rights reserved.
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| -#ifndef CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_SERVICE_TEST_UTIL_H_
|
| -#define CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_SERVICE_TEST_UTIL_H_
|
| +#ifndef CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_SERVICE_FACTORY_TEST_UTIL_H_
|
| +#define CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_SERVICE_FACTORY_TEST_UTIL_H_
|
|
|
| #include <string>
|
|
|
| #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"
|
|
|
| -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 {
|
| +// TemplateURLServiceFactoryTestUtil initializes TemplateURLServiceFactory to
|
| +// return a valid TemplateURLService instance for the given profile.
|
| +class TemplateURLServiceFactoryTestUtil {
|
| public:
|
| - TemplateURLServiceTestUtilBase();
|
| - virtual ~TemplateURLServiceTestUtilBase();
|
| -
|
| - void CreateTemplateUrlService();
|
| -
|
| - // TemplateURLServiceObserver implemementation.
|
| - virtual void OnTemplateURLServiceChanged() OVERRIDE;
|
| -
|
| - // Gets the observer count.
|
| - int GetObserverCount();
|
| -
|
| - // Sets the observer count to 0.
|
| - void ResetObserverCount();
|
| + explicit TemplateURLServiceFactoryTestUtil(TestingProfile* profile);
|
| + virtual ~TemplateURLServiceFactoryTestUtil();
|
|
|
| - // Makes sure the load was successful and sent the correct notification.
|
| + // Makes sure the load was successful.
|
| void VerifyLoad();
|
|
|
| - // Makes the model believe it has been loaded (without actually doing the
|
| - // load). Since this avoids setting the built-in keyword version, the next
|
| - // load will do a merge from prepopulated data.
|
| - void ChangeModelToLoadState();
|
| -
|
| - // Deletes the current model (and doesn't create a new one).
|
| - void ClearModel();
|
| -
|
| - // Creates a new TemplateURLService.
|
| - void ResetModel(bool verify_load);
|
| -
|
| - // Returns the search term from the last invocation of
|
| - // TemplateURLService::SetKeywordSearchTermsForURL and clears the search term.
|
| - base::string16 GetAndClearSearchTerm();
|
| -
|
| - // Set the google base url. |base_url| must be valid.
|
| - void SetGoogleBaseURL(const GURL& base_url) const;
|
| -
|
| // Set the managed preferences for the default search provider and trigger
|
| // notification. If |alternate_url| is empty, uses an empty list of alternate
|
| // URLs, otherwise use a list containing a single entry.
|
| @@ -82,41 +43,10 @@ class TemplateURLServiceTestUtilBase : public TemplateURLServiceObserver {
|
| // 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();
|
| -
|
| - // Returns the TestingProfile.
|
| - virtual TestingProfile* profile() const OVERRIDE;
|
| -
|
| private:
|
| - // Needed to make the DeleteOnUIThread trait of WebDataService work
|
| - // properly.
|
| - content::TestBrowserThreadBundle thread_bundle_;
|
| - scoped_ptr<TestingProfile> profile_;
|
| - base::ScopedTempDir temp_dir_;
|
| + TestingProfile* profile_;
|
|
|
| - DISALLOW_COPY_AND_ASSIGN(TemplateURLServiceTestUtil);
|
| + DISALLOW_COPY_AND_ASSIGN(TemplateURLServiceFactoryTestUtil);
|
| };
|
|
|
| -#endif // CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_SERVICE_TEST_UTIL_H_
|
| +#endif // CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_SERVICE_FACTORY_TEST_UTIL_H_
|
|
|