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

Unified Diff: components/ntp_tiles/field_trial.cc

Issue 2737573003: Remove Popular Sites experiment on iOS. (Closed)
Patch Set: Created 3 years, 9 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
« no previous file with comments | « components/ntp_tiles/field_trial.h ('k') | ios/chrome/browser/ios_chrome_field_trials.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/ntp_tiles/field_trial.cc
diff --git a/components/ntp_tiles/field_trial.cc b/components/ntp_tiles/field_trial.cc
index e3f5f6d7c7a659dcc5a83480a266b75ae612e97f..6bcbf98207f003465040b545481ce9d7d3506a40 100644
--- a/components/ntp_tiles/field_trial.cc
+++ b/components/ntp_tiles/field_trial.cc
@@ -2,83 +2,26 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "base/metrics/field_trial.h"
+#include "components/ntp_tiles/field_trial.h"
#if defined(OS_ANDROID)
#include <jni.h>
#endif
+#include <string>
#include "base/command_line.h"
#include "base/metrics/field_trial.h"
#include "base/strings/string_util.h"
#include "components/ntp_tiles/constants.h"
-#include "components/ntp_tiles/field_trial.h"
#include "components/ntp_tiles/switches.h"
-#include "components/variations/variations_associated_data.h"
#if defined(OS_ANDROID)
#include "base/android/jni_android.h"
#include "jni/MostVisitedSites_jni.h"
#endif
-namespace {
-const char kPopularSiteDefaultGroup[] = "Default";
-const char kPopularSiteControlGroup[] = "Control";
-const char kPopularSiteEnabledGroup[] = "Enabled";
-const char kPopularSiteEnabledCommandLineSwitchGroup[] =
- "EnabledWithCommandLineSwitch";
-const char kPopularSiteDisabledCommandLineSwitchGroup[] =
- "DisabledWithCommandLineSwitch";
-} // namespace
-
namespace ntp_tiles {
-// On iOS it is not technically possible to prep the field trials on first
-// launch, the configuration file is downloaded too late. In order to run some
-// experiments that need to be active on first launch to be meaningful these
-// are hardcoded, but can be superceeded by a server side config on subsequent
-// launches.
-void SetUpFirstLaunchFieldTrial(bool is_stable_channel) {
- // Check first if a server side config superceeded this experiment.
- if (base::FieldTrialList::TrialExists(kPopularSitesFieldTrialName))
- return;
-
- // The experiment is only for stable channel, the other channels will simply
- // get the default behavior.
- if (!is_stable_channel)
- return;
-
- // Stable channels will run with 10% probability.
- const base::FieldTrial::Probability kTotalProbability = 100;
- const base::FieldTrial::Probability kEnabledAndControlProbability = 10;
-
- // Experiment enabled until April 26, 2017.
- scoped_refptr<base::FieldTrial> trial(
- base::FieldTrialList::FactoryGetFieldTrial(
- kPopularSitesFieldTrialName, kTotalProbability,
- kPopularSiteDefaultGroup, 2017, 4, 26, // Apr 26, 2017
- base::FieldTrial::ONE_TIME_RANDOMIZED, nullptr));
-
- base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
- if (command_line->HasSwitch(ntp_tiles::switches::kEnableNTPPopularSites)) {
- trial->AppendGroup(kPopularSiteEnabledCommandLineSwitchGroup,
- kTotalProbability);
- } else if (command_line->HasSwitch(
- ntp_tiles::switches::kDisableNTPPopularSites)) {
- trial->AppendGroup(kPopularSiteDisabledCommandLineSwitchGroup,
- kTotalProbability);
- } else {
- trial->AppendGroup(kPopularSiteControlGroup, kEnabledAndControlProbability);
- AssociateGoogleVariationID(variations::GOOGLE_WEB_PROPERTIES,
- kPopularSitesFieldTrialName,
- kPopularSiteControlGroup, 3312959);
- trial->AppendGroup(kPopularSiteEnabledGroup, kEnabledAndControlProbability);
- AssociateGoogleVariationID(variations::GOOGLE_WEB_PROPERTIES,
- kPopularSitesFieldTrialName,
- kPopularSiteEnabledGroup, 3312958);
- }
-}
-
bool ShouldShowPopularSites() {
// Note: It's important to query the field trial state first, to ensure that
// UMA reports the correct group.
@@ -102,7 +45,7 @@ bool ShouldShowPopularSites() {
#if defined(OS_IOS)
// On iOS, if not enrolled in the experiment, the default is to enable the
// feature.
- if (group_name.empty() || (group_name == kPopularSiteDefaultGroup))
+ if (group_name.empty())
return true;
#endif
« no previous file with comments | « components/ntp_tiles/field_trial.h ('k') | ios/chrome/browser/ios_chrome_field_trials.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698