Commit 938488a7 authored by isherman's avatar isherman Committed by Commit bot

[Cleanup] Remove some expired omnibox field trials.

BUG=none
TEST=none
R=mpearson@chromium.org

Review URL: https://codereview.chromium.org/1584733003

Cr-Commit-Position: refs/heads/master@{#370734}
parent f5ab6b86
...@@ -549,10 +549,8 @@ void SearchProviderTest::ResetFieldTrialList() { ...@@ -549,10 +549,8 @@ void SearchProviderTest::ResetFieldTrialList() {
field_trial_list_.reset(new base::FieldTrialList( field_trial_list_.reset(new base::FieldTrialList(
new metrics::SHA1EntropyProvider("foo"))); new metrics::SHA1EntropyProvider("foo")));
variations::testing::ClearAllVariationParams(); variations::testing::ClearAllVariationParams();
base::FieldTrial* trial = base::FieldTrialList::CreateFieldTrial(
"AutocompleteDynamicTrial_0", "DefaultGroup");
trial->group();
} }
base::FieldTrial* SearchProviderTest::CreateFieldTrial( base::FieldTrial* SearchProviderTest::CreateFieldTrial(
const char* field_trial_rule, const char* field_trial_rule,
bool enabled) { bool enabled) {
...@@ -2550,6 +2548,10 @@ TEST_F(SearchProviderTest, DefaultProviderSuggestRelevanceScoringUrlInput) { ...@@ -2550,6 +2548,10 @@ TEST_F(SearchProviderTest, DefaultProviderSuggestRelevanceScoringUrlInput) {
// A basic test that verifies the field trial triggered parsing logic. // A basic test that verifies the field trial triggered parsing logic.
TEST_F(SearchProviderTest, FieldTrialTriggeredParsing) { TEST_F(SearchProviderTest, FieldTrialTriggeredParsing) {
base::FieldTrial* trial = base::FieldTrialList::CreateFieldTrial(
OmniboxFieldTrial::kBundledExperimentFieldTrialName, "DefaultGroup");
trial->group();
QueryForInputAndWaitForFetcherResponses( QueryForInputAndWaitForFetcherResponses(
ASCIIToUTF16("foo"), false, ASCIIToUTF16("foo"), false,
"[\"foo\",[\"foo bar\"],[\"\"],[]," "[\"foo\",[\"foo bar\"],[\"\"],[],"
......
...@@ -13,7 +13,6 @@ ...@@ -13,7 +13,6 @@
#include "build/build_config.h" #include "build/build_config.h"
#include "chrome/common/chrome_switches.h" #include "chrome/common/chrome_switches.h"
#include "components/metrics/metrics_pref_names.h" #include "components/metrics/metrics_pref_names.h"
#include "components/omnibox/browser/omnibox_field_trial.h"
#if defined(OS_ANDROID) || defined(OS_IOS) #if defined(OS_ANDROID) || defined(OS_IOS)
#include "chrome/browser/chrome_browser_field_trials_mobile.h" #include "chrome/browser/chrome_browser_field_trials_mobile.h"
...@@ -44,6 +43,4 @@ void ChromeBrowserFieldTrials::InstantiateDynamicTrials() { ...@@ -44,6 +43,4 @@ void ChromeBrowserFieldTrials::InstantiateDynamicTrials() {
// The following trials are used from renderer process. // The following trials are used from renderer process.
// Mark here so they will be sync-ed. // Mark here so they will be sync-ed.
base::FieldTrialList::FindValue("DisplayList2dCanvas"); base::FieldTrialList::FindValue("DisplayList2dCanvas");
// Activate the autocomplete dynamic field trials.
OmniboxFieldTrial::ActivateDynamicTrials();
} }
...@@ -12,7 +12,6 @@ ...@@ -12,7 +12,6 @@
#include "base/strings/string_number_conversions.h" #include "base/strings/string_number_conversions.h"
#include "base/strings/string_split.h" #include "base/strings/string_split.h"
#include "base/strings/string_util.h" #include "base/strings/string_util.h"
#include "base/strings/stringprintf.h"
#include "base/time/time.h" #include "base/time/time.h"
#include "build/build_config.h" #include "build/build_config.h"
#include "components/metrics/proto/omnibox_event.pb.h" #include "components/metrics/proto/omnibox_event.pb.h"
...@@ -32,20 +31,6 @@ typedef HUPScoringParams::ScoreBuckets ScoreBuckets; ...@@ -32,20 +31,6 @@ typedef HUPScoringParams::ScoreBuckets ScoreBuckets;
// Field trial names. // Field trial names.
const char kStopTimerFieldTrialName[] = "OmniboxStopTimer"; const char kStopTimerFieldTrialName[] = "OmniboxStopTimer";
// The autocomplete dynamic field trial name prefix. Each field trial is
// configured dynamically and is retrieved automatically by Chrome during
// the startup.
const char kAutocompleteDynamicFieldTrialPrefix[] = "AutocompleteDynamicTrial_";
// The maximum number of the autocomplete dynamic field trials (aka layers).
const int kMaxAutocompleteDynamicFieldTrials = 5;
// Concatenates the autocomplete dynamic field trial prefix with a field trial
// ID to form a complete autocomplete field trial name.
std::string DynamicFieldTrialName(int id) {
return base::StringPrintf("%s%d", kAutocompleteDynamicFieldTrialPrefix, id);
}
void InitializeBucketsFromString(const std::string& bucket_string, void InitializeBucketsFromString(const std::string& bucket_string,
ScoreBuckets* score_buckets) { ScoreBuckets* score_buckets) {
// Clear the buckets. // Clear the buckets.
...@@ -123,13 +108,6 @@ double HUPScoringParams::ScoreBuckets::HalfLifeTimeDecay( ...@@ -123,13 +108,6 @@ double HUPScoringParams::ScoreBuckets::HalfLifeTimeDecay(
return pow(2.0, -half_life_intervals); return pow(2.0, -half_life_intervals);
} }
void OmniboxFieldTrial::ActivateDynamicTrials() {
// Initialize all autocomplete dynamic field trials. This method may be
// called multiple times.
for (int i = 0; i < kMaxAutocompleteDynamicFieldTrials; ++i)
base::FieldTrialList::FindValue(DynamicFieldTrialName(i));
}
int OmniboxFieldTrial::GetDisabledProviderTypes() { int OmniboxFieldTrial::GetDisabledProviderTypes() {
const std::string& types_string = variations::GetVariationParamValue( const std::string& types_string = variations::GetVariationParamValue(
kBundledExperimentFieldTrialName, kBundledExperimentFieldTrialName,
...@@ -144,11 +122,6 @@ int OmniboxFieldTrial::GetDisabledProviderTypes() { ...@@ -144,11 +122,6 @@ int OmniboxFieldTrial::GetDisabledProviderTypes() {
void OmniboxFieldTrial::GetActiveSuggestFieldTrialHashes( void OmniboxFieldTrial::GetActiveSuggestFieldTrialHashes(
std::vector<uint32_t>* field_trial_hashes) { std::vector<uint32_t>* field_trial_hashes) {
field_trial_hashes->clear(); field_trial_hashes->clear();
for (int i = 0; i < kMaxAutocompleteDynamicFieldTrials; ++i) {
const std::string& trial_name = DynamicFieldTrialName(i);
if (base::FieldTrialList::TrialExists(trial_name))
field_trial_hashes->push_back(metrics::HashName(trial_name));
}
if (base::FieldTrialList::TrialExists(kBundledExperimentFieldTrialName)) { if (base::FieldTrialList::TrialExists(kBundledExperimentFieldTrialName)) {
field_trial_hashes->push_back( field_trial_hashes->push_back(
metrics::HashName(kBundledExperimentFieldTrialName)); metrics::HashName(kBundledExperimentFieldTrialName));
......
...@@ -111,14 +111,6 @@ class OmniboxFieldTrial { ...@@ -111,14 +111,6 @@ class OmniboxFieldTrial {
EMPHASIZE_NEVER = 3 EMPHASIZE_NEVER = 3
}; };
// Activates all dynamic field trials. The main difference between
// the autocomplete dynamic and static field trials is that the former
// don't require any code changes on the Chrome side as they are controlled
// on the server side. Chrome binary simply propagates all necessary
// information through the X-Client-Data header.
// This method may be called multiple times.
static void ActivateDynamicTrials();
// --------------------------------------------------------- // ---------------------------------------------------------
// For any experiment that's part of the bundled omnibox field trial. // For any experiment that's part of the bundled omnibox field trial.
......
...@@ -31,7 +31,6 @@ class OmniboxFieldTrialTest : public testing::Test { ...@@ -31,7 +31,6 @@ class OmniboxFieldTrialTest : public testing::Test {
field_trial_list_.reset(new base::FieldTrialList( field_trial_list_.reset(new base::FieldTrialList(
new metrics::SHA1EntropyProvider("foo"))); new metrics::SHA1EntropyProvider("foo")));
variations::testing::ClearAllVariationParams(); variations::testing::ClearAllVariationParams();
OmniboxFieldTrial::ActivateDynamicTrials();
} }
// Creates and activates a field trial. // Creates and activates a field trial.
...@@ -138,12 +137,6 @@ void OmniboxFieldTrialTest::VerifySuggestPollingStrategy( ...@@ -138,12 +137,6 @@ void OmniboxFieldTrialTest::VerifySuggestPollingStrategy(
TEST_F(OmniboxFieldTrialTest, GetDisabledProviderTypes) { TEST_F(OmniboxFieldTrialTest, GetDisabledProviderTypes) {
EXPECT_EQ(0, OmniboxFieldTrial::GetDisabledProviderTypes()); EXPECT_EQ(0, OmniboxFieldTrial::GetDisabledProviderTypes());
{
SCOPED_TRACE("Outside the bundled field trial.");
CreateTestTrial("AutocompleteDynamicTrial_0", "DisabledProviders_123");
EXPECT_EQ(0, OmniboxFieldTrial::GetDisabledProviderTypes());
}
{ {
SCOPED_TRACE("Valid field trial, missing param."); SCOPED_TRACE("Valid field trial, missing param.");
ResetFieldTrialList(); ResetFieldTrialList();
......
...@@ -5,23 +5,9 @@ ...@@ -5,23 +5,9 @@
#include "ios/chrome/browser/ios_chrome_field_trials.h" #include "ios/chrome/browser/ios_chrome_field_trials.h"
#include "base/metrics/field_trial.h" #include "base/metrics/field_trial.h"
#include "components/omnibox/browser/omnibox_field_trial.h"
namespace {
// Instantiates dynamic field trials by querying their state to ensure they
// get reported as used.
void InstantiateDynamicTrials() {
// Activate the autocomplete dynamic field trials.
OmniboxFieldTrial::ActivateDynamicTrials();
// Activate the iOS tab eviction dynamic field trials.
base::FieldTrialList::FindValue("TabEviction");
}
} // namespace
void SetupFieldTrials(const base::CommandLine& command_line, void SetupFieldTrials(const base::CommandLine& command_line,
const base::Time& install_time) { const base::Time& install_time) {
InstantiateDynamicTrials(); // Activate the iOS tab eviction dynamic field trials.
base::FieldTrialList::FindValue("TabEviction");
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment