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

Unified Diff: chrome/browser/profile_resetter/automatic_profile_resetter_delegate_unittest.cc

Issue 376413002: Stop using TemplateURLServiceTestUtil to initialize TemplateURLServiceFactory (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Eliminate SetUp() and TearDown() 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/profile_resetter/automatic_profile_resetter_delegate_unittest.cc
diff --git a/chrome/browser/profile_resetter/automatic_profile_resetter_delegate_unittest.cc b/chrome/browser/profile_resetter/automatic_profile_resetter_delegate_unittest.cc
index b9ea0fb028bf95d2f907beadee0df5f00a247e60..72831d57fe56c3ed013dae8447db3770385d08db 100644
--- a/chrome/browser/profile_resetter/automatic_profile_resetter_delegate_unittest.cc
+++ b/chrome/browser/profile_resetter/automatic_profile_resetter_delegate_unittest.cc
@@ -26,7 +26,7 @@
#include "chrome/browser/profile_resetter/brandcoded_default_settings.h"
#include "chrome/browser/profile_resetter/profile_reset_global_error.h"
#include "chrome/browser/search_engines/template_url_service_factory.h"
-#include "chrome/browser/search_engines/template_url_service_test_util.h"
+#include "chrome/browser/search_engines/template_url_service_factory_test_util.h"
#include "chrome/browser/ui/global_error/global_error.h"
#include "chrome/browser/ui/global_error/global_error_service.h"
#include "chrome/browser/ui/global_error/global_error_service_factory.h"
@@ -162,8 +162,7 @@ void ServicePendingBrancodedConfigFetch(net::TestURLFetcher* fetcher,
// ExtensionServiceTestBase sets up a TestingProfile with the ExtensionService,
// we then add the TemplateURLService, so the ProfileResetter can be exercised.
class AutomaticProfileResetterDelegateTest
- : public extensions::ExtensionServiceTestBase,
- public TemplateURLServiceTestUtilBase {
+ : public extensions::ExtensionServiceTestBase {
protected:
AutomaticProfileResetterDelegateTest() {}
virtual ~AutomaticProfileResetterDelegateTest() {}
@@ -173,13 +172,14 @@ class AutomaticProfileResetterDelegateTest
ExtensionServiceInitParams params = CreateDefaultInitParams();
params.pref_file.clear(); // Prescribes a TestingPrefService to be created.
InitializeExtensionService(params);
- TemplateURLServiceTestUtilBase::CreateTemplateUrlService();
+ util_.reset(new TemplateURLServiceFactoryTestUtil(profile_.get()));
resetter_delegate_.reset(
new AutomaticProfileResetterDelegateUnderTest(profile()));
}
virtual void TearDown() OVERRIDE {
resetter_delegate_.reset();
+ util_.reset();
extensions::ExtensionServiceTestBase::TearDown();
}
@@ -233,10 +233,10 @@ class AutomaticProfileResetterDelegateTest
return resetter_delegate_.get();
}
- // TemplateURLServiceTestUtilBase:
- virtual TestingProfile* profile() const OVERRIDE { return profile_.get(); }
+ TemplateURLServiceFactoryTestUtil* util() { return util_.get(); }
private:
+ scoped_ptr<TemplateURLServiceFactoryTestUtil> util_;
engedy 2014/07/16 08:21:09 nit: Could you please rename this to be a bit more
hashimoto 2014/07/16 09:04:41 Done.
net::TestURLFetcherFactory test_url_fetcher_factory_;
scoped_ptr<AutomaticProfileResetterDelegateUnderTest> resetter_delegate_;
@@ -346,7 +346,7 @@ TEST_F(AutomaticProfileResetterDelegateTest,
DefaultSearchProviderDataWhenNotManaged) {
TemplateURLService* template_url_service =
TemplateURLServiceFactory::GetForProfile(profile());
- TemplateURLServiceTestUtilBase::VerifyLoad();
+ util()->VerifyLoad();
// Check that the "managed state" and the details returned by the delegate are
// correct. We verify the details against the data stored by
@@ -373,12 +373,12 @@ TEST_F(AutomaticProfileResetterDelegateTest,
const char kTestName[] = "name";
const char kTestKeyword[] = "keyword";
- TemplateURLServiceTestUtilBase::VerifyLoad();
+ util()->VerifyLoad();
EXPECT_FALSE(resetter_delegate()->IsDefaultSearchProviderManaged());
// Set managed preferences to emulate a default search provider set by policy.
- SetManagedDefaultSearchPreferences(
+ util()->SetManagedDefaultSearchPreferences(
true, kTestName, kTestKeyword, kTestSearchURL, std::string(),
std::string(), std::string(), std::string(), std::string());
@@ -391,8 +391,8 @@ TEST_F(AutomaticProfileResetterDelegateTest,
// Set managed preferences to emulate that having a default search provider is
// disabled by policy.
- RemoveManagedDefaultSearchPreferences();
- SetManagedDefaultSearchPreferences(
+ util()->RemoveManagedDefaultSearchPreferences();
+ util()->SetManagedDefaultSearchPreferences(
false, std::string(), std::string(), std::string(), std::string(),
std::string(), std::string(), std::string(), std::string());
@@ -405,7 +405,7 @@ TEST_F(AutomaticProfileResetterDelegateTest,
GetPrepopulatedSearchProvidersDetails) {
TemplateURLService* template_url_service =
TemplateURLServiceFactory::GetForProfile(profile());
- TemplateURLServiceTestUtilBase::VerifyLoad();
+ util()->VerifyLoad();
scoped_ptr<base::ListValue> search_engines_details(
resetter_delegate()->GetPrepopulatedSearchProvidersDetails());

Powered by Google App Engine
This is Rietveld 408576698