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

Unified Diff: chrome/browser/ui/search/local_ntp_browsertest.cc

Issue 2910843002: [Cleanup] Move all browsertests to use ScopedFeatureList to modify features
Patch Set: Move SFL calls to constructor Created 3 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/ui/search/local_ntp_browsertest.cc
diff --git a/chrome/browser/ui/search/local_ntp_browsertest.cc b/chrome/browser/ui/search/local_ntp_browsertest.cc
index a3b0bf6b00a277493713fbe22c2a6abbe4a3593f..3461bd257b94c39e4a20318ce554e7c2494035c6 100644
--- a/chrome/browser/ui/search/local_ntp_browsertest.cc
+++ b/chrome/browser/ui/search/local_ntp_browsertest.cc
@@ -11,7 +11,9 @@
#include "base/memory/ptr_util.h"
#include "base/optional.h"
#include "base/strings/utf_string_conversions.h"
+#include "base/test/scoped_feature_list.h"
#include "base/threading/thread_restrictions.h"
+#include "build/build_config.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/search/one_google_bar/one_google_bar_data.h"
@@ -26,6 +28,7 @@
#include "chrome/browser/ui/search/instant_test_base.h"
#include "chrome/browser/ui/search/instant_test_utils.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h"
+#include "chrome/common/chrome_features.h"
#include "chrome/common/pref_names.h"
#include "chrome/common/url_constants.h"
#include "chrome/test/base/in_process_browser_test.h"
@@ -265,13 +268,11 @@ IN_PROC_BROWSER_TEST_F(LocalNTPTest,
// wrangling. It just turns on the local NTP.
class LocalNTPSmokeTest : public InProcessBrowserTest {
public:
- LocalNTPSmokeTest() {}
-
- protected:
- void SetUpCommandLine(base::CommandLine* cmdline) override {
- cmdline->AppendSwitchASCII(switches::kEnableFeatures, "UseGoogleLocalNtp");
+ LocalNTPSmokeTest() {
+ scoped_feature_list_.InitAndEnableFeature(features::kUseGoogleLocalNtp);
}
+ protected:
void SetUserSelectedDefaultSearchProvider(const std::string& base_url) {
base::ThreadRestrictions::ScopedAllowIO allow_io;
TemplateURLData data;
@@ -285,6 +286,9 @@ class LocalNTPSmokeTest : public InProcessBrowserTest {
template_url_service->Add(base::MakeUnique<TemplateURL>(data));
template_url_service->SetUserSelectedDefaultSearchProvider(template_url);
}
+
+ private:
+ base::test::ScopedFeatureList scoped_feature_list_;
};
IN_PROC_BROWSER_TEST_F(LocalNTPSmokeTest, GoogleNTPLoadsWithoutError) {
@@ -372,14 +376,16 @@ class FakeOneGoogleBarFetcher : public OneGoogleBarFetcher {
class LocalNTPOneGoogleBarSmokeTest : public InProcessBrowserTest {
public:
- LocalNTPOneGoogleBarSmokeTest() {}
-
- protected:
- void SetUpCommandLine(base::CommandLine* cmdline) override {
- cmdline->AppendSwitchASCII(switches::kEnableFeatures,
- "UseGoogleLocalNtp,OneGoogleBarOnLocalNtp");
+ LocalNTPOneGoogleBarSmokeTest() {
+#if !defined(OS_ANDROID) && !defined(OS_IOS)
+ scoped_feature_list_.InitWithFeatures(
+ {features::kUseGoogleLocalNtp, features::kOneGoogleBarOnLocalNtp}, {});
+#else
+ scoped_feature_list_.InitAndEnableFeature(features::kUseGoogleLocalNtp);
+#endif
}
+ protected:
void SetUpInProcessBrowserTestFixture() override {
will_create_browser_context_services_subscription_ =
BrowserContextDependencyManager::GetInstance()
@@ -412,6 +418,7 @@ class LocalNTPOneGoogleBarSmokeTest : public InProcessBrowserTest {
std::unique_ptr<
base::CallbackList<void(content::BrowserContext*)>::Subscription>
will_create_browser_context_services_subscription_;
+ base::test::ScopedFeatureList scoped_feature_list_;
};
IN_PROC_BROWSER_TEST_F(LocalNTPOneGoogleBarSmokeTest,
« no previous file with comments | « chrome/browser/ui/exclusive_access/fullscreen_controller_interactive_browsertest.cc ('k') | chrome/common/chrome_features.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698