Chromium Code Reviews| 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..8090f76409c51eb3a098855dd7dcb75bd8adc57c 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,51 @@ IN_PROC_BROWSER_TEST_F(ContentBrowserTestSanityTest, SingleProcess) { |
| namespace { |
| +const base::Feature kTestFeatureForContentBrowserTest{ |
|
Ilya Sherman
2017/06/09 20:19:28
nit: Please add an extra space before the curly br
|
| + "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); |
| + 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)); |
|
Ilya Sherman
2017/06/09 20:19:28
I don't understand. Where is the feature being en
chaopeng
2017/06/13 04:16:32
Sorry, Forgot to test it before send to you.
|
| +} |
| + |
| +namespace { |
| + |
| void CallbackChecker(bool* non_nested_task_ran) { |
| *non_nested_task_ran = true; |
| } |