Drop ntp_snippets::kStudyName in chrome://flags

Also, remove the param that sets the content suggestions server. We no
longer have support for anything else, but on Canary/Dev, it has the
undesired behavior of switching away from the staging server.

BUG=706347

Review-Url: https://codereview.chromium.org/2782233002
Cr-Commit-Position: refs/heads/master@{#460728}
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/ntp/cards/CardsVariationParameters.java b/chrome/android/java/src/org/chromium/chrome/browser/ntp/cards/CardsVariationParameters.java
index 67bf0a1..154a25c 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/ntp/cards/CardsVariationParameters.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/ntp/cards/CardsVariationParameters.java
@@ -23,7 +23,6 @@
     private static final String TAG = "CardsVariationParams";
 
     // Also defined in ntp_snippets_constants.cc
-    private static final String FIELD_TRIAL_NAME_MAIN = "NTPSnippets";
     private static final String FIELD_TRIAL_NAME_VISIBILITY = "NTPSnippetsVisibility";
 
     private static final String PARAM_FAVICON_SERVICE_NAME = "favicons_fetch_from_service";
@@ -38,6 +37,9 @@
 
     private static final int FIRST_CARD_ANIMATION_DEFAULT_VALUE = 7;
 
+    // TODO(sfiera): replace with feature-specific field trials, as has been done in C++.
+    private static final String FIELD_TRIAL_NAME_MAIN = "NTPSnippets";
+
     private CardsVariationParameters() {}
 
     // TODO(jkrcal): Do a proper general fix in VariationsAssociatedData in the spirit of
diff --git a/chrome/browser/about_flags.cc b/chrome/browser/about_flags.cc
index cfb5e20..7b6ea0f 100644
--- a/chrome/browser/about_flags.cc
+++ b/chrome/browser/about_flags.cc
@@ -574,19 +574,10 @@
 #endif  // OS_ANDROID
 
 #if defined(OS_ANDROID)
-const FeatureEntry::FeatureParam
-    kRemoteSuggestionsFeatureVariationContentSuggestionsServer[] = {
-        {"content_suggestions_backend",
-         ntp_snippets::kContentSuggestionsServer}};
-
 const FeatureEntry::FeatureVariation kRemoteSuggestionsFeatureVariations[] = {
-    {"via content suggestion server (backed by ChromeReader)",
-     kRemoteSuggestionsFeatureVariationContentSuggestionsServer,
-     arraysize(kRemoteSuggestionsFeatureVariationContentSuggestionsServer),
+    {"via content suggestion server (backed by ChromeReader)", nullptr, 0,
      nullptr},
-    {"via content suggestion server (backed by Google Now)",
-     kRemoteSuggestionsFeatureVariationContentSuggestionsServer,
-     arraysize(kRemoteSuggestionsFeatureVariationContentSuggestionsServer),
+    {"via content suggestion server (backed by Google Now)", nullptr, 0,
      "3313279"}};
 #endif  // OS_ANDROID
 
@@ -1971,7 +1962,7 @@
      FEATURE_WITH_PARAMS_VALUE_TYPE(
          ntp_snippets::kCategoryOrder,
          kContentSuggestionsCategoryOrderFeatureVariations,
-         ntp_snippets::kStudyName)},
+         ntp_snippets::kCategoryOrder.name)},
     {"content-suggestions-category-ranker",
      flag_descriptions::kContentSuggestionsCategoryRankerName,
      flag_descriptions::kContentSuggestionsCategoryRankerDescription,
@@ -1979,7 +1970,7 @@
      FEATURE_WITH_PARAMS_VALUE_TYPE(
          ntp_snippets::kCategoryRanker,
          kContentSuggestionsCategoryRankerFeatureVariations,
-         ntp_snippets::kStudyName)},
+         ntp_snippets::kCategoryRanker.name)},
     {"enable-ntp-snippets-increased-visibility",
      flag_descriptions::kEnableNtpSnippetsVisibilityName,
      flag_descriptions::kEnableNtpSnippetsVisibilityDescription, kOsAndroid,
@@ -1999,9 +1990,10 @@
     {"enable-ntp-remote-suggestions",
      flag_descriptions::kEnableNtpRemoteSuggestionsName,
      flag_descriptions::kEnableNtpRemoteSuggestionsDescription, kOsAndroid,
-     FEATURE_WITH_PARAMS_VALUE_TYPE(ntp_snippets::kArticleSuggestionsFeature,
-                                    kRemoteSuggestionsFeatureVariations,
-                                    ntp_snippets::kStudyName)},
+     FEATURE_WITH_PARAMS_VALUE_TYPE(
+         ntp_snippets::kArticleSuggestionsFeature,
+         kRemoteSuggestionsFeatureVariations,
+         ntp_snippets::kArticleSuggestionsFeature.name)},
     {"enable-ntp-recent-offline-tab-suggestions",
      flag_descriptions::kEnableNtpRecentOfflineTabSuggestionsName,
      flag_descriptions::kEnableNtpRecentOfflineTabSuggestionsDescription,
@@ -2038,7 +2030,7 @@
      FEATURE_WITH_PARAMS_VALUE_TYPE(
          params::ntp_snippets::kNotificationsFeature,
          kContentSuggestionsNotificationsFeatureVariations,
-         ntp_snippets::kStudyName)},
+         params::ntp_snippets::kNotificationsFeature.name)},
     {"ntp-condensed-layout", flag_descriptions::kNtpCondensedLayoutName,
      flag_descriptions::kNtpCondensedLayoutDescription, kOsAndroid,
      FEATURE_VALUE_TYPE(chrome::android::kNTPCondensedLayoutFeature)},
@@ -2048,7 +2040,7 @@
      FEATURE_WITH_PARAMS_VALUE_TYPE(
          chrome::android::kNTPCondensedTileLayoutFeature,
          kNTPCondensedTileLayoutFeatureVariations,
-         ntp_snippets::kStudyName)},
+         chrome::android::kNTPCondensedTileLayoutFeature.name)},
     {"ntp-google-g-in-omnibox", flag_descriptions::kNtpGoogleGInOmniboxName,
      flag_descriptions::kNtpGoogleGInOmniboxDescription, kOsAndroid,
      FEATURE_VALUE_TYPE(chrome::android::NTPShowGoogleGInOmniboxFeature)},
diff --git a/components/ntp_snippets/category_rankers/click_based_category_ranker_unittest.cc b/components/ntp_snippets/category_rankers/click_based_category_ranker_unittest.cc
index 172789b..da07fc4 100644
--- a/components/ntp_snippets/category_rankers/click_based_category_ranker_unittest.cc
+++ b/components/ntp_snippets/category_rankers/click_based_category_ranker_unittest.cc
@@ -84,7 +84,7 @@
 
   void SetDismissedCategoryPenaltyVariationParam(int value) {
     variation_params_manager_.SetVariationParamsWithFeatureAssociations(
-        ntp_snippets::kStudyName,
+        kCategoryRanker.name,
         {{"click_based_category_ranker-dismissed_category_penalty",
           base::IntToString(value)}},
         {kCategoryRanker.name});
@@ -92,7 +92,7 @@
 
   void SetPromotedCategoryVariationParam(int value) {
     variation_params_manager_.SetVariationParamsWithFeatureAssociations(
-        ntp_snippets::kStudyName,
+        kCategoryRanker.name,
         {{"click_based_category_ranker-promoted_category",
           base::IntToString(value)}},
         {kCategoryRanker.name});
diff --git a/components/ntp_snippets/ntp_snippets_constants.cc b/components/ntp_snippets/ntp_snippets_constants.cc
index d09040b..8230493 100644
--- a/components/ntp_snippets/ntp_snippets_constants.cc
+++ b/components/ntp_snippets/ntp_snippets_constants.cc
@@ -6,9 +6,6 @@
 
 namespace ntp_snippets {
 
-// Also defined in SnippetArticleViewHolder.java
-const char kStudyName[] = "NTPSnippets";
-
 const base::FilePath::CharType kDatabaseFolder[] =
     FILE_PATH_LITERAL("NTPSnippets");
 
diff --git a/components/ntp_snippets/ntp_snippets_constants.h b/components/ntp_snippets/ntp_snippets_constants.h
index 2c17eb0..aff5c37 100644
--- a/components/ntp_snippets/ntp_snippets_constants.h
+++ b/components/ntp_snippets/ntp_snippets_constants.h
@@ -9,9 +9,6 @@
 
 namespace ntp_snippets {
 
-// Name of the variation parameters study to configure NTP snippets.
-extern const char kStudyName[];
-
 // Name of the folder where the snippets database should be stored. This is only
 // the name of the folder, not a full path - it must be appended to e.g. the
 // profile path.
diff --git a/components/ntp_snippets/remote/json_request_unittest.cc b/components/ntp_snippets/remote/json_request_unittest.cc
index 9284219..d19f2c8 100644
--- a/components/ntp_snippets/remote/json_request_unittest.cc
+++ b/components/ntp_snippets/remote/json_request_unittest.cc
@@ -61,7 +61,7 @@
  public:
   JsonRequestTest()
       : params_manager_(
-            ntp_snippets::kStudyName,
+            ntp_snippets::kArticleSuggestionsFeature.name,
             {{"send_top_languages", "true"}, {"send_user_class", "true"}},
             {ntp_snippets::kArticleSuggestionsFeature.name}),
         pref_service_(base::MakeUnique<TestingPrefServiceSimple>()),
diff --git a/components/ntp_snippets/remote/remote_suggestions_fetcher_unittest.cc b/components/ntp_snippets/remote/remote_suggestions_fetcher_unittest.cc
index 246372e..7607efe 100644
--- a/components/ntp_snippets/remote/remote_suggestions_fetcher_unittest.cc
+++ b/components/ntp_snippets/remote/remote_suggestions_fetcher_unittest.cc
@@ -271,7 +271,7 @@
   explicit RemoteSuggestionsFetcherTestBase(const GURL& gurl)
       : default_variation_params_(
             {{"send_top_languages", "true"}, {"send_user_class", "true"}}),
-        params_manager_(ntp_snippets::kStudyName,
+        params_manager_(ntp_snippets::kArticleSuggestionsFeature.name,
                         default_variation_params_,
                         {ntp_snippets::kArticleSuggestionsFeature.name}),
         mock_task_runner_(new base::TestMockTimeTaskRunner()),
@@ -358,7 +358,7 @@
 
     params_manager_.ClearAllVariationParams();
     params_manager_.SetVariationParamsWithFeatureAssociations(
-        ntp_snippets::kStudyName, params,
+        ntp_snippets::kArticleSuggestionsFeature.name, params,
         {ntp_snippets::kArticleSuggestionsFeature.name});
   }
 
diff --git a/components/ntp_snippets/remote/remote_suggestions_provider_impl_unittest.cc b/components/ntp_snippets/remote/remote_suggestions_provider_impl_unittest.cc
index b5b2064..6716ef4 100644
--- a/components/ntp_snippets/remote/remote_suggestions_provider_impl_unittest.cc
+++ b/components/ntp_snippets/remote/remote_suggestions_provider_impl_unittest.cc
@@ -399,7 +399,7 @@
 class RemoteSuggestionsProviderImplTest : public ::testing::Test {
  public:
   RemoteSuggestionsProviderImplTest()
-      : params_manager_(ntp_snippets::kStudyName,
+      : params_manager_(ntp_snippets::kArticleSuggestionsFeature.name,
                         {{"content_suggestions_backend",
                           kTestContentSuggestionsServerEndpoint}},
                         {ntp_snippets::kArticleSuggestionsFeature.name}),
diff --git a/components/ntp_snippets/remote/remote_suggestions_scheduler_impl_unittest.cc b/components/ntp_snippets/remote/remote_suggestions_scheduler_impl_unittest.cc
index a23d250..3ad4455 100644
--- a/components/ntp_snippets/remote/remote_suggestions_scheduler_impl_unittest.cc
+++ b/components/ntp_snippets/remote/remote_suggestions_scheduler_impl_unittest.cc
@@ -106,7 +106,7 @@
         default_variation_params_{{"scheduler_trigger_types",
                                    "persistent_scheduler_wake_up,ntp_opened,"
                                    "browser_foregrounded,browser_cold_start"}},
-        params_manager_(ntp_snippets::kStudyName,
+        params_manager_(ntp_snippets::kArticleSuggestionsFeature.name,
                         default_variation_params_,
                         {kArticleSuggestionsFeature.name}),
         user_classifier_(/*pref_service=*/nullptr,
@@ -142,7 +142,7 @@
 
     params_manager_.ClearAllVariationParams();
     params_manager_.SetVariationParamsWithFeatureAssociations(
-        ntp_snippets::kStudyName, params,
+        ntp_snippets::kArticleSuggestionsFeature.name, params,
         {ntp_snippets::kArticleSuggestionsFeature.name});
   }
 
diff --git a/components/ntp_snippets/user_classifier_unittest.cc b/components/ntp_snippets/user_classifier_unittest.cc
index f8f3a43..882e7e6 100644
--- a/components/ntp_snippets/user_classifier_unittest.cc
+++ b/components/ntp_snippets/user_classifier_unittest.cc
@@ -90,7 +90,7 @@
        ShouldBecomeActiveSuggestionsConsumerByClickingOftenWithDecreasedParam) {
   // Increase the param to one half.
   variations::testing::VariationParamsManager variation_params(
-      kStudyName,
+      kArticleSuggestionsFeature.name,
       {{"user_classifier_active_consumer_clicks_at_least_once_per_hours",
         "36"}},
       {kArticleSuggestionsFeature.name});
@@ -128,7 +128,7 @@
        ShouldBecomeRareNtpUserByNoActivityWithDecreasedParam) {
   // Decrease the param to one half.
   variations::testing::VariationParamsManager variation_params(
-      kStudyName,
+      kArticleSuggestionsFeature.name,
       {{"user_classifier_rare_user_opens_ntp_at_most_once_per_hours", "48"}},
       {kArticleSuggestionsFeature.name});
   UserClassifier* user_classifier = CreateUserClassifier();
@@ -230,7 +230,7 @@
   UserClassifier::Metric metric = GetParam().first;
   // Increase the min_hours to 1.0, i.e. 60 minutes.
   variations::testing::VariationParamsManager variation_params(
-      kStudyName, {{"user_classifier_min_hours", "1.0"}},
+      kArticleSuggestionsFeature.name, {{"user_classifier_min_hours", "1.0"}},
       {kArticleSuggestionsFeature.name});
   UserClassifier* user_classifier = CreateUserClassifier();
 
@@ -277,7 +277,7 @@
   UserClassifier::Metric metric = GetParam().first;
   // Decrease the max_hours to 72, i.e. 3 days.
   variations::testing::VariationParamsManager variation_params(
-      kStudyName, {{"user_classifier_max_hours", "72"}},
+      kArticleSuggestionsFeature.name, {{"user_classifier_max_hours", "72"}},
       {kArticleSuggestionsFeature.name});
   UserClassifier* user_classifier = CreateUserClassifier();