| Index: content/test/content_browser_test_test.cc
|
| diff --git a/content/test/content_browser_test_test.cc b/content/test/content_browser_test_test.cc
|
| index 446349da297ec89a96034c706cf6336173bc719d..5a5bf2942211545edd2f750fcb3065e665e9afdb 100644
|
| --- a/content/test/content_browser_test_test.cc
|
| +++ b/content/test/content_browser_test_test.cc
|
| @@ -8,8 +8,10 @@
|
| #include "base/location.h"
|
| #include "base/process/launch.h"
|
| #include "base/single_thread_task_runner.h"
|
| +#include "base/strings/string_split.h"
|
| #include "base/strings/utf_string_conversions.h"
|
| #include "base/test/launcher/test_launcher.h"
|
| +#include "base/test/scoped_feature_list.h"
|
| #include "base/threading/thread_restrictions.h"
|
| #include "base/threading/thread_task_runner_handle.h"
|
| #include "build/build_config.h"
|
| @@ -178,6 +180,53 @@ IN_PROC_BROWSER_TEST_F(ContentBrowserTestSanityTest, SingleProcess) {
|
|
|
| namespace {
|
|
|
| +const base::Feature kTestFeatureForContentBrowserTest{
|
| + "TestFeatureForContentBrowserTest", base::FEATURE_DISABLED_BY_DEFAULT};
|
| +
|
| +} // namespace
|
| +
|
| +class ContentBrowserTestScopedFeatureListTest : public ContentBrowserTest {
|
| + public:
|
| + void SetUp() override {
|
| + std::string disabled_features;
|
| + base::FeatureList::GetInstance()->GetFeatureOverrides(&enabled_features_,
|
| + &disabled_features);
|
| + scoped_feature_list_.InitAndEnableFeature(
|
| + kTestFeatureForContentBrowserTest);
|
| + ContentBrowserTest::SetUp();
|
| + }
|
| +
|
| + std::string enabled_features_;
|
| +
|
| + private:
|
| + base::test::ScopedFeatureList scoped_feature_list_;
|
| +};
|
| +
|
| +IN_PROC_BROWSER_TEST_F(ContentBrowserTestScopedFeatureListTest,
|
| + FeatureListTest) {
|
| + std::string enabled_features0;
|
| + std::string disabled_features0;
|
| +
|
| + base::FeatureList::GetInstance()->GetFeatureOverrides(&enabled_features0,
|
| + &disabled_features0);
|
| +
|
| + base::StringPiece enabled_features = enabled_features0;
|
| +
|
| + // Ensure we repected the features from command line.
|
| + std::vector<base::StringPiece> original_enabled_features =
|
| + base::SplitStringPiece(enabled_features_, ",", base::TRIM_WHITESPACE,
|
| + base::SPLIT_WANT_NONEMPTY);
|
| +
|
| + for (base::StringPiece enabled_feature : original_enabled_features) {
|
| + EXPECT_NE(enabled_features.find(enabled_feature), base::StringPiece::npos);
|
| + }
|
| +
|
| + // Ensure kTestFeatureForContentBrowserTest enabled.
|
| + EXPECT_TRUE(base::FeatureList::IsEnabled(kTestFeatureForContentBrowserTest));
|
| +}
|
| +
|
| +namespace {
|
| +
|
| void CallbackChecker(bool* non_nested_task_ran) {
|
| *non_nested_task_ran = true;
|
| }
|
|
|