summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbartn@chromium.org <bartn@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-04-13 02:04:06 +0000
committerbartn@chromium.org <bartn@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-04-13 02:04:06 +0000
commitfea6d302d237bb0a3945f027587a4fa435e6a5cc (patch)
treefd24f4f2c12e9c36d9fa8ada7bb54a23beead8df
parent1b73f77e889f3dbd181fed25adeb36d1f58ccd74 (diff)
downloadchromium_src-fea6d302d237bb0a3945f027587a4fa435e6a5cc.zip
chromium_src-fea6d302d237bb0a3945f027587a4fa435e6a5cc.tar.gz
chromium_src-fea6d302d237bb0a3945f027587a4fa435e6a5cc.tar.bz2
Clean up the unused Suggest field trial and make GetActiveSuggestFieldTrialHash
use the dynamic field trials instead of the static one being deleted in this change. BUG=228910 Review URL: https://chromiumcodereview.appspot.com/13940005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@194074 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/autocomplete/search_provider.cc9
-rw-r--r--chrome/browser/autocomplete/search_provider_unittest.cc4
-rw-r--r--chrome/browser/omnibox/omnibox_field_trial.cc59
-rw-r--r--chrome/browser/omnibox/omnibox_field_trial.h9
-rw-r--r--chrome/common/metrics/variations/variation_ids.h18
5 files changed, 28 insertions, 71 deletions
diff --git a/chrome/browser/autocomplete/search_provider.cc b/chrome/browser/autocomplete/search_provider.cc
index 6b92d82f..be43ae1 100644
--- a/chrome/browser/autocomplete/search_provider.cc
+++ b/chrome/browser/autocomplete/search_provider.cc
@@ -419,13 +419,14 @@ void SearchProvider::AddProviderInfo(ProvidersInfo* provider_info) const {
metrics::OmniboxEventProto_ProviderInfo& new_entry = provider_info->back();
new_entry.set_provider(AsOmniboxEventProviderType());
new_entry.set_provider_done(done_);
- uint32 field_trial_hash = 0;
- if (OmniboxFieldTrial::GetActiveSuggestFieldTrialHash(&field_trial_hash)) {
+ std::vector<uint32> field_trial_hashes;
+ OmniboxFieldTrial::GetActiveSuggestFieldTrialHashes(&field_trial_hashes);
+ for (size_t i = 0; i < field_trial_hashes.size(); ++i) {
if (field_trial_triggered_)
- new_entry.mutable_field_trial_triggered()->Add(field_trial_hash);
+ new_entry.mutable_field_trial_triggered()->Add(field_trial_hashes[i]);
if (field_trial_triggered_in_session_) {
new_entry.mutable_field_trial_triggered_in_session()->Add(
- field_trial_hash);
+ field_trial_hashes[i]);
}
}
}
diff --git a/chrome/browser/autocomplete/search_provider_unittest.cc b/chrome/browser/autocomplete/search_provider_unittest.cc
index 3266369..54bbdb1 100644
--- a/chrome/browser/autocomplete/search_provider_unittest.cc
+++ b/chrome/browser/autocomplete/search_provider_unittest.cc
@@ -168,7 +168,9 @@ void SearchProviderTest::SetUpTestCase() {
// Set up Suggest experiments.
field_trial_list_ = new base::FieldTrialList(
new metrics::SHA1EntropyProvider("foo"));
- OmniboxFieldTrial::ActivateStaticTrials();
+ base::FieldTrial* trial = base::FieldTrialList::CreateFieldTrial(
+ "AutocompleteDynamicTrial_0", "DefaultGroup");
+ trial->group();
}
// static
diff --git a/chrome/browser/omnibox/omnibox_field_trial.cc b/chrome/browser/omnibox/omnibox_field_trial.cc
index 904b2b6..2751f13 100644
--- a/chrome/browser/omnibox/omnibox_field_trial.cc
+++ b/chrome/browser/omnibox/omnibox_field_trial.cc
@@ -18,11 +18,6 @@ namespace {
// Field trial names.
const char kDisallowInlineHQPFieldTrialName[] = "OmniboxDisallowInlineHQP";
-// Because we regularly change the name of the suggest field trial in
-// order to shuffle users among groups, we use the date the current trial
-// was created as part of the name.
-const char kSuggestFieldTrialStarted2013Q1Name[] =
- "OmniboxSearchSuggestTrialStarted2013Q1";
const char kHQPNewScoringFieldTrialName[] = "OmniboxHQPNewScoringMax1400";
const char kHUPCullRedirectsFieldTrialName[] = "OmniboxHUPCullRedirects";
const char kHUPCreateShorterMatchFieldTrialName[] =
@@ -45,11 +40,6 @@ const base::FieldTrial::Probability kDisallowInlineHQPFieldTrialDivisor = 100;
const base::FieldTrial::Probability
kDisallowInlineHQPFieldTrialExperimentFraction = 0;
-// For the search suggestion field trial, divide the people in the
-// trial into 20 equally-sized buckets. The suggest provider backend
-// will decide what behavior (if any) to change based on the group.
-const int kSuggestFieldTrialNumberOfGroups = 20;
-
// For History Quick Provider new scoring field trial, put 0% ( = 0/100 )
// of the users in the new scoring experiment group.
const base::FieldTrial::Probability kHQPNewScoringFieldTrialDivisor = 100;
@@ -140,40 +130,6 @@ void OmniboxFieldTrial::ActivateStaticTrials() {
disallow_inline_hqp_experiment_group = trial->AppendGroup("DisallowInline",
kDisallowInlineHQPFieldTrialExperimentFraction);
- // Create the suggest field trial.
- // Make it expire on September 1, 2013.
- trial = base::FieldTrialList::FactoryGetFieldTrial(
- kSuggestFieldTrialStarted2013Q1Name, kSuggestFieldTrialNumberOfGroups,
- "0", 2013, 9, 1, NULL);
- trial->UseOneTimeRandomization();
-
- // Mark this group in suggest requests to Google.
- chrome_variations::AssociateGoogleVariationID(
- chrome_variations::GOOGLE_WEB_PROPERTIES,
- kSuggestFieldTrialStarted2013Q1Name, "0",
- chrome_variations::SUGGEST_TRIAL_STARTED_2013_Q1_ID_MIN);
- DCHECK_EQ(kSuggestFieldTrialNumberOfGroups,
- chrome_variations::SUGGEST_TRIAL_STARTED_2013_Q1_ID_MAX -
- chrome_variations::SUGGEST_TRIAL_STARTED_2013_Q1_ID_MIN + 1);
-
- // We've already created one group; now just need to create
- // kSuggestFieldTrialNumGroups - 1 more. Mark these groups in
- // suggest requests to Google.
- for (int i = 1; i < kSuggestFieldTrialNumberOfGroups; i++) {
- const std::string group_name = base::IntToString(i);
- trial->AppendGroup(group_name, 1);
- chrome_variations::AssociateGoogleVariationID(
- chrome_variations::GOOGLE_WEB_PROPERTIES,
- kSuggestFieldTrialStarted2013Q1Name, group_name,
- static_cast<chrome_variations::VariationID>(
- chrome_variations::SUGGEST_TRIAL_STARTED_2013_Q1_ID_MIN + i));
- }
-
- // Make sure that we participate in the suggest experiment by calling group()
- // on the newly created field trial. This is necessary to activate the field
- // trial group as there are no more references to it within the Chrome code.
- trial->group();
-
// Create inline History Quick Provider new scoring field trial.
// Make it expire on April 14, 2013.
trial = base::FieldTrialList::FactoryGetFieldTrial(
@@ -266,13 +222,14 @@ bool OmniboxFieldTrial::InDisallowInlineHQPFieldTrialExperimentGroup() {
return group == disallow_inline_hqp_experiment_group;
}
-bool OmniboxFieldTrial::GetActiveSuggestFieldTrialHash(
- uint32* field_trial_hash) {
- if (!base::FieldTrialList::TrialExists(kSuggestFieldTrialStarted2013Q1Name))
- return false;
-
- *field_trial_hash = metrics::HashName(kSuggestFieldTrialStarted2013Q1Name);
- return true;
+void OmniboxFieldTrial::GetActiveSuggestFieldTrialHashes(
+ std::vector<uint32>* field_trial_hashes) {
+ 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));
+ }
}
bool OmniboxFieldTrial::InHQPNewScoringFieldTrial() {
diff --git a/chrome/browser/omnibox/omnibox_field_trial.h b/chrome/browser/omnibox/omnibox_field_trial.h
index 0371c3b..5783476 100644
--- a/chrome/browser/omnibox/omnibox_field_trial.h
+++ b/chrome/browser/omnibox/omnibox_field_trial.h
@@ -6,6 +6,7 @@
#define CHROME_BROWSER_OMNIBOX_OMNIBOX_FIELD_TRIAL_H_
#include <string>
+#include <vector>
#include "base/basictypes.h"
@@ -48,10 +49,10 @@ class OmniboxFieldTrial {
// ---------------------------------------------------------
// For the suggest field trial.
- // Fills in |field_trial_hash| with a hash of the active suggest field trial
- // name, if any. Returns true if the suggest field trial was active and
- // |field_trial_hash| was initialized.
- static bool GetActiveSuggestFieldTrialHash(uint32* field_trial_hash);
+ // Populates |field_trial_hash| with hashes of the active suggest field trial
+ // names, if any.
+ static void GetActiveSuggestFieldTrialHashes(
+ std::vector<uint32>* field_trial_hash);
// ---------------------------------------------------------
// For the History Quick Provider new scoring field trial.
diff --git a/chrome/common/metrics/variations/variation_ids.h b/chrome/common/metrics/variations/variation_ids.h
index 19c3fc9..d2ccb33 100644
--- a/chrome/common/metrics/variations/variation_ids.h
+++ b/chrome/common/metrics/variations/variation_ids.h
@@ -99,9 +99,9 @@ enum VariationID {
// Add new variation IDs below.
+ // DEPRECATED - DO NOT USE
// Name: OmniboxSearchSuggest
// Range: 3310000 - 3310019
- // Suggest (Autocomplete) field trial, 20 IDs.
// Now retired. But please don't reuse these IDs; they may taint
// your experiment results.
SUGGEST_ID_MIN = 3310000,
@@ -121,13 +121,11 @@ enum VariationID {
DUMMY_INSTANT_ID_EXPERIMENT_2 = 3310028,
DUMMY_INSTANT_ID_EXPERIMENT_3 = 3310049,
+ // DEPRECATED - DO NOT USE
// Name: OmniboxSearchSuggestStarted2012Q4
// Range: 3310029 - 3310048
- // Suggest (Autocomplete) field trial, 20 IDs. This differs from
- // the earlier omnibox suggest field trial in this file because
- // we created a new trial (with a new name) in order to shuffle IDs.
- // We assign new experiment IDs because it's a good practice not to
- // reuse experiment IDs.
+ // Now retired. But please don't reuse these IDs; they may taint
+ // your experiment results.
SUGGEST_TRIAL_STARTED_2012_Q4_ID_MIN = 3310029,
SUGGEST_TRIAL_STARTED_2012_Q4_ID_MAX = 3310048,
@@ -141,13 +139,11 @@ enum VariationID {
EXTENDED_INSTANT_ID_DEV_GROUP_1 = 3310055,
EXTENDED_INSTANT_ID_DEV_CONTROL = 3310056,
+ // DEPRECATED - DO NOT USE
// Name: OmniboxSearchSuggestTrialStarted2013Q1
// Range: 3310060 - 3310079
- // Suggest (Autocomplete) field trial, 20 IDs. This differs from
- // the earlier omnibox suggest field trials in this file because
- // we created a new trial (with a new name) in order to shuffle IDs.
- // We assign new experiment IDs because it's a good practice not to
- // reuse experiment IDs.
+ // Now retired. But please don't reuse these IDs; they may taint
+ // your experiment results.
SUGGEST_TRIAL_STARTED_2013_Q1_ID_MIN = 3310060,
SUGGEST_TRIAL_STARTED_2013_Q1_ID_MAX = 3310079,