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..0cc1019d3e9ded8bd9c942eddfb2c13cf31ab545 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" |
chaopeng
2017/06/30 19:32:37
I got warning point to add this header file.
Ilya Sherman
2017/07/03 21:21:59
That makes sense, since you're adding OS_ #if-stmt
|
#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" |
@@ -268,8 +271,9 @@ class LocalNTPSmokeTest : public InProcessBrowserTest { |
LocalNTPSmokeTest() {} |
protected: |
- void SetUpCommandLine(base::CommandLine* cmdline) override { |
- cmdline->AppendSwitchASCII(switches::kEnableFeatures, "UseGoogleLocalNtp"); |
+ void SetUp() override { |
+ scoped_feature_list_.InitAndEnableFeature(features::kUseGoogleLocalNtp); |
+ InProcessBrowserTest::SetUp(); |
} |
void SetUserSelectedDefaultSearchProvider(const std::string& base_url) { |
@@ -285,6 +289,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) { |
@@ -375,9 +382,14 @@ class LocalNTPOneGoogleBarSmokeTest : public InProcessBrowserTest { |
LocalNTPOneGoogleBarSmokeTest() {} |
protected: |
- void SetUpCommandLine(base::CommandLine* cmdline) override { |
- cmdline->AppendSwitchASCII(switches::kEnableFeatures, |
- "UseGoogleLocalNtp,OneGoogleBarOnLocalNtp"); |
+ void SetUp() override { |
+#if !defined(OS_ANDROID) && !defined(OS_IOS) |
+ scoped_feature_list_.InitWithFeatures( |
+ {features::kUseGoogleLocalNtp, features::kOneGoogleBarOnLocalNtp}, {}); |
+#else |
+ scoped_feature_list_.InitAndEnableFeature(features::kUseGoogleLocalNtp); |
+#endif |
+ InProcessBrowserTest::SetUp(); |
} |
void SetUpInProcessBrowserTestFixture() override { |
@@ -412,6 +424,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, |