Revert "Show Variations info in cmd format in about:version."
This reverts commit 5b240cfb0644278915664861fd0ec04185dd0bc4.
Reason for revert: breaking tests on iOS bot:
https://ci.chromium.org/buildbot/chromium.mac/ios-simulator-full-configs/2677
VisibleURLTestCase/testDoubleForwardNavigationToWebUIPage:
[0201/113634.854499:FATAL:template_expressions.cc(97)] Check failed: value != replacements.end(). $i18n replacement key "variations_cmd_name" not found
Original change's description:
> Show Variations info in cmd format in about:version.
>
> When navigating to about:version/?show-variations-cmd an additional section
> will appear showing complete set of client's variations in the command line
> formatting that can be used to reproduce the same exact state of variations.
> The displayed info contains all the trials including not activated ones
> marked by '*' along with the corresponding group assignment.
> It will also contain enabled and disabled features where the ones that should
> use the default value will be marked with '*'(e.g. expired trials).
> Trials that are unforcable through command line will be shown but warning will
> be shown when processing the command line input with unforcable trial.
> This CL doesn't cover iOS.
>
> As the displayed text is huge I also changed the width of the text in the
> about:version page (not mobile) to be 60% of the page with a minimum of 800px
> as it used to be.
>
> Bug: 694675
> TEST=unit test, manual testing
> 1. run chrome with --fake-variations-channel=beta
> 2. copying command line input from about:version/?show-variations-cmd
> 3. run chrome without channel but with command line input copied in step 2.
> 4. confirm about:version/?show-variations-cmd page shows the same info
>
> Change-Id: Ie73174bd5bd1a02baa75cd3294fd36cf63b3c923
> Reviewed-on: https://chromium-review.googlesource.com/865286
> Commit-Queue: Gayane Petrosyan <gayane@chromium.org>
> Reviewed-by: Dave Schuyler <dschuyler@chromium.org>
> Reviewed-by: Alexei Svitkine <asvitkine@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#533742}
TBR=asvitkine@chromium.org,gayane@chromium.org,dschuyler@chromium.org
Change-Id: I81dd667cfde45c209eed9889c0785fc0587b123d
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 694675
Reviewed-on: https://chromium-review.googlesource.com/898405
Reviewed-by: Tommy Steimel <steimel@chromium.org>
Commit-Queue: Tommy Steimel <steimel@chromium.org>
Cr-Commit-Position: refs/heads/master@{#533844}
CrOS-Libchrome-Original-Commit: 6788e47ad67b94f8423714617798aa57da54db46
diff --git a/base/metrics/field_trial.cc b/base/metrics/field_trial.cc
index 485498f..0214f5a 100644
--- a/base/metrics/field_trial.cc
+++ b/base/metrics/field_trial.cc
@@ -676,50 +676,6 @@
}
// static
-std::string FieldTrialList::AllParamsToString(bool include_expired,
- EscapeDataFunc encode_data_func) {
- FieldTrialParamAssociator* params_associator =
- FieldTrialParamAssociator::GetInstance();
- std::string output;
- for (const auto& registered : GetRegisteredTrials()) {
- FieldTrial::State trial;
- if (!registered.second->GetStateWhileLocked(&trial, include_expired))
- continue;
- DCHECK_EQ(std::string::npos,
- trial.trial_name->find(kPersistentStringSeparator));
- DCHECK_EQ(std::string::npos,
- trial.group_name->find(kPersistentStringSeparator));
- std::map<std::string, std::string> params;
- if (params_associator->GetFieldTrialParamsWithoutFallback(
- *trial.trial_name, *trial.group_name, ¶ms)) {
- if (params.size() > 0) {
- // Add comma to seprate from previous entry if it exists.
- if (!output.empty())
- output.append(1, ',');
-
- output.append(encode_data_func(*trial.trial_name));
- output.append(1, '.');
- output.append(encode_data_func(*trial.group_name));
- output.append(1, ':');
-
- std::string param_str;
- for (const auto& param : params) {
- // Add separator from previous param information if it exists.
- if (!param_str.empty())
- param_str.append(1, kPersistentStringSeparator);
- param_str.append(encode_data_func(param.first));
- param_str.append(1, kPersistentStringSeparator);
- param_str.append(encode_data_func(param.second));
- }
-
- output.append(param_str);
- }
- }
- }
- return output;
-}
-
-// static
void FieldTrialList::GetActiveFieldTrialGroups(
FieldTrial::ActiveGroups* active_groups) {
DCHECK(active_groups->empty());
@@ -800,13 +756,8 @@
const std::string trial_name = entry.trial_name.as_string();
const std::string group_name = entry.group_name.as_string();
- if (ContainsKey(ignored_trial_names, trial_name)) {
- // This is to warn that the field trial forced through command-line
- // input is unforcable.
- // Use --enable-logging or --enable-logging=stderr to see this warning.
- LOG(WARNING) << "Field trial: " << trial_name << " cannot be forced.";
+ if (ContainsKey(ignored_trial_names, trial_name))
continue;
- }
FieldTrial* trial = CreateFieldTrial(trial_name, group_name);
if (!trial)
@@ -1477,14 +1428,4 @@
global_->registered_[trial->trial_name()] = trial;
}
-// static
-FieldTrialList::RegistrationMap FieldTrialList::GetRegisteredTrials() {
- RegistrationMap output;
- if (global_) {
- AutoLock auto_lock(global_->lock_);
- output = global_->registered_;
- }
- return output;
-}
-
} // namespace base
diff --git a/base/metrics/field_trial.h b/base/metrics/field_trial.h
index 10122ff..c58666c 100644
--- a/base/metrics/field_trial.h
+++ b/base/metrics/field_trial.h
@@ -393,10 +393,6 @@
public:
typedef SharedPersistentMemoryAllocator FieldTrialAllocator;
- // Type for function pointer passed to |AllParamsToString| used to escape
- // special characters from |input|.
- typedef std::string (*EscapeDataFunc)(const std::string& input);
-
// Year that is guaranteed to not be expired when instantiating a field trial
// via |FactoryGetFieldTrial()|. Set to two years from the build date.
static int kNoExpirationYear;
@@ -514,16 +510,6 @@
// by |CreateTrialsFromString()|.
static void AllStatesToString(std::string* output, bool include_expired);
- // Creates a persistent representation of all FieldTrial params for
- // resurrection in another process. The returned string contains the trial
- // name and group name pairs of all registered FieldTrials including disabled
- // based on |include_expired| separated by '.'. The pair is followed by ':'
- // separator and list of param name and values separated by '/'. It also takes
- // |encode_data_func| function pointer for encodeing special charactors.
- // This string is parsed by |AssociateParamsFromString()|.
- static std::string AllParamsToString(bool include_expired,
- EscapeDataFunc encode_data_func);
-
// Fills in the supplied vector |active_groups| (which must be empty when
// called) with a snapshot of all registered FieldTrials for which the group
// has been chosen and externally observed (via |group()|) and which have
@@ -737,9 +723,6 @@
// This should always be called after creating a new FieldTrial instance.
static void Register(FieldTrial* trial);
- // Returns all the registered trials.
- static RegistrationMap GetRegisteredTrials();
-
static FieldTrialList* global_; // The singleton of this class.
// This will tell us if there is an attempt to register a field
diff --git a/base/metrics/field_trial_unittest.cc b/base/metrics/field_trial_unittest.cc
index 16419be..406f561 100644
--- a/base/metrics/field_trial_unittest.cc
+++ b/base/metrics/field_trial_unittest.cc
@@ -75,10 +75,6 @@
DISALLOW_COPY_AND_ASSIGN(TestFieldTrialObserver);
};
-std::string MockEscapeQueryParamValue(const std::string& input) {
- return input;
-}
-
} // namespace
class FieldTrialTest : public ::testing::Test {
@@ -1410,36 +1406,4 @@
}
#endif // !OS_NACL && !OS_WIN && !OS_FUCHSIA
-TEST_F(FieldTrialTest, TestAllParamsToString) {
- std::string exptected_output = "t1.g1:p1/v1/p2/v2";
-
- // Create study with one group and two params.
- std::map<std::string, std::string> params;
- params["p1"] = "v1";
- params["p2"] = "v2";
- FieldTrialParamAssociator::GetInstance()->AssociateFieldTrialParams(
- "t1", "g1", params);
- EXPECT_EQ(
- "", FieldTrialList::AllParamsToString(false, &MockEscapeQueryParamValue));
-
- scoped_refptr<FieldTrial> trial1 =
- CreateFieldTrial("t1", 100, "Default", nullptr);
- trial1->AppendGroup("g1", 100);
- trial1->group();
- EXPECT_EQ(exptected_output, FieldTrialList::AllParamsToString(
- false, &MockEscapeQueryParamValue));
-
- // Create study with two groups and params that don't belog to the assigned
- // group. This should be in the output.
- FieldTrialParamAssociator::GetInstance()->AssociateFieldTrialParams(
- "t2", "g2", params);
- scoped_refptr<FieldTrial> trial2 =
- CreateFieldTrial("t2", 100, "Default", nullptr);
- trial2->AppendGroup("g1", 100);
- trial2->AppendGroup("g2", 0);
- trial2->group();
- EXPECT_EQ(exptected_output, FieldTrialList::AllParamsToString(
- false, &MockEscapeQueryParamValue));
-}
-
} // namespace base