| Index: chrome/common/metrics/variations/variations_util.cc
|
| diff --git a/chrome/common/metrics/variations/variations_util.cc b/chrome/common/metrics/variations/variations_util.cc
|
| index 5ef0bf89d3ef8337225a4fdb555346b8daed17ce..de15fd6978a9df01a469b2d7442b86689d922bc0 100644
|
| --- a/chrome/common/metrics/variations/variations_util.cc
|
| +++ b/chrome/common/metrics/variations/variations_util.cc
|
| @@ -6,22 +6,14 @@
|
|
|
| #include <vector>
|
|
|
| -#include "base/strings/string16.h"
|
| -#include "base/strings/string_number_conversions.h"
|
| -#include "base/strings/string_split.h"
|
| -#include "base/strings/string_util.h"
|
| #include "base/strings/stringprintf.h"
|
| #include "base/strings/utf_string_conversions.h"
|
| #include "chrome/common/child_process_logging.h"
|
| -#include "chrome/installer/util/google_update_experiment_util.h"
|
|
|
| namespace chrome_variations {
|
|
|
| namespace {
|
|
|
| -const char kVariationPrefix[] = "CrVar";
|
| -const char kExperimentLabelSep[] = ";";
|
| -
|
| // Populates |name_group_ids| based on |active_groups|.
|
| void GetFieldTrialActiveGroupIdsForActiveGroups(
|
| const base::FieldTrial::ActiveGroups& active_groups,
|
| @@ -34,25 +26,6 @@ void GetFieldTrialActiveGroupIdsForActiveGroups(
|
| }
|
| }
|
|
|
| -// This method builds a single experiment label for a Chrome Variation,
|
| -// including a timestamp that is a year in the future from now. Since multiple
|
| -// headers can be transmitted, |count| is a number that is appended after the
|
| -// label key to differentiate the labels.
|
| -string16 CreateSingleExperimentLabel(int count, VariationID id) {
|
| - // Build the parts separately so they can be validated.
|
| - const string16 key =
|
| - ASCIIToUTF16(kVariationPrefix) + base::IntToString16(count);
|
| - DCHECK_LE(key.size(), 8U);
|
| - const string16 value = base::IntToString16(id);
|
| - DCHECK_LE(value.size(), 8U);
|
| - string16 label(key);
|
| - label += ASCIIToUTF16("=");
|
| - label += value;
|
| - label += ASCIIToUTF16("|");
|
| - label += installer::BuildExperimentDateString();
|
| - return label;
|
| -}
|
| -
|
| } // namespace
|
|
|
| void GetFieldTrialActiveGroupIds(
|
| @@ -103,66 +76,6 @@ void SetChildProcessLoggingVariationList() {
|
| child_process_logging::SetExperimentList(experiment_strings);
|
| }
|
|
|
| -string16 BuildGoogleUpdateExperimentLabel(
|
| - const base::FieldTrial::ActiveGroups& active_groups) {
|
| - string16 experiment_labels;
|
| - int counter = 0;
|
| -
|
| - // Find all currently active VariationIDs associated with Google Update.
|
| - for (base::FieldTrial::ActiveGroups::const_iterator it =
|
| - active_groups.begin(); it != active_groups.end(); ++it) {
|
| - const VariationID id = GetGoogleVariationID(GOOGLE_UPDATE_SERVICE,
|
| - it->trial_name, it->group_name);
|
| -
|
| - if (id == EMPTY_ID)
|
| - continue;
|
| -
|
| - if (!experiment_labels.empty())
|
| - experiment_labels += ASCIIToUTF16(kExperimentLabelSep);
|
| - experiment_labels += CreateSingleExperimentLabel(++counter, id);
|
| - }
|
| -
|
| - return experiment_labels;
|
| -}
|
| -
|
| -string16 ExtractNonVariationLabels(const string16& labels) {
|
| - const string16 separator = ASCIIToUTF16(kExperimentLabelSep);
|
| - string16 non_variation_labels;
|
| -
|
| - // First, split everything by the label separator.
|
| - std::vector<string16> entries;
|
| - base::SplitStringUsingSubstr(labels, separator, &entries);
|
| -
|
| - // For each label, keep the ones that do not look like a Variations label.
|
| - for (std::vector<string16>::const_iterator it = entries.begin();
|
| - it != entries.end(); ++it) {
|
| - if (it->empty() || StartsWith(*it, ASCIIToUTF16(kVariationPrefix), false))
|
| - continue;
|
| -
|
| - // Dump the whole thing, including the timestamp.
|
| - if (!non_variation_labels.empty())
|
| - non_variation_labels += separator;
|
| - non_variation_labels += *it;
|
| - }
|
| -
|
| - return non_variation_labels;
|
| -}
|
| -
|
| -string16 CombineExperimentLabels(const string16& variation_labels,
|
| - const string16& other_labels) {
|
| - const string16 separator = ASCIIToUTF16(kExperimentLabelSep);
|
| - DCHECK(!StartsWith(variation_labels, separator, false));
|
| - DCHECK(!EndsWith(variation_labels, separator, false));
|
| - DCHECK(!StartsWith(other_labels, separator, false));
|
| - DCHECK(!EndsWith(other_labels, separator, false));
|
| - // Note that if either label is empty, a separator is not necessary.
|
| - string16 combined_labels = other_labels;
|
| - if (!other_labels.empty() && !variation_labels.empty())
|
| - combined_labels += separator;
|
| - combined_labels += variation_labels;
|
| - return combined_labels;
|
| -}
|
| -
|
| // Functions below are exposed for testing explicitly behind this namespace.
|
| // They simply wrap existing functions in this file.
|
| namespace testing {
|
|
|