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

Unified Diff: base/feature_list_unittest.cc

Issue 1471693007: Make FeatureList override state be plumbed to renderer processes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Match function order in header file. Created 5 years, 1 month 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 | « base/feature_list.cc ('k') | content/browser/renderer_host/render_process_host_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/feature_list_unittest.cc
diff --git a/base/feature_list_unittest.cc b/base/feature_list_unittest.cc
index cb8f74466f258c2213f20bf3be8c8633a09ef238..9169421da3564284f95380659bf2cc9385ed3870 100644
--- a/base/feature_list_unittest.cc
+++ b/base/feature_list_unittest.cc
@@ -6,6 +6,7 @@
#include "base/format_macros.h"
#include "base/metrics/field_trial.h"
+#include "base/strings/string_util.h"
#include "base/strings/stringprintf.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -23,6 +24,13 @@ struct Feature kFeatureOffByDefault {
kFeatureOffByDefaultName, FEATURE_DISABLED_BY_DEFAULT
};
+std::string SortFeatureListString(const std::string& feature_list) {
+ std::vector<std::string> features =
+ FeatureList::SplitFeatureListString(feature_list);
+ std::sort(features.begin(), features.end());
+ return JoinString(features, ",");
+}
+
} // namespace
class FeatureListTest : public testing::Test {
@@ -308,4 +316,25 @@ TEST_F(FeatureListTest, AssociateReportingFieldTrial) {
}
}
+TEST_F(FeatureListTest, GetFeatureOverrides) {
+ ClearFeatureListInstance();
+ FieldTrialList field_trial_list(nullptr);
+ scoped_ptr<FeatureList> feature_list(new FeatureList);
+ feature_list->InitializeFromCommandLine("A,X", "D");
+
+ FieldTrial* trial = FieldTrialList::CreateFieldTrial("Trial", "Group");
+ feature_list->RegisterFieldTrialOverride(kFeatureOffByDefaultName,
+ FeatureList::OVERRIDE_ENABLE_FEATURE,
+ trial);
+
+ RegisterFeatureListInstance(feature_list.Pass());
+
+ std::string enable_features;
+ std::string disable_features;
+ FeatureList::GetInstance()->GetFeatureOverrides(&enable_features,
+ &disable_features);
+ EXPECT_EQ("A,OffByDefault,X", SortFeatureListString(enable_features));
+ EXPECT_EQ("D", SortFeatureListString(disable_features));
+}
+
} // namespace base
« no previous file with comments | « base/feature_list.cc ('k') | content/browser/renderer_host/render_process_host_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698