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

Unified Diff: content/test/content_browser_test_test.cc

Issue 2876153002: Support Using ScopedFeatureList in BrowserTest (Closed)
Patch Set: revert changes in commandline Created 3 years, 6 months 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
« base/test/test_suite.cc ('K') | « chrome/test/base/test_launcher_utils.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..503222ab9104b795929c9a4f038f3f9e14a6fbe7 100644
--- a/content/test/content_browser_test_test.cc
+++ b/content/test/content_browser_test_test.cc
@@ -8,8 +8,11 @@
#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_command_line.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 +181,39 @@ IN_PROC_BROWSER_TEST_F(ContentBrowserTestSanityTest, SingleProcess) {
namespace {
+const base::Feature kTestFeatureForBrowserTest1{
+ "TestFeatureForBrowserTest1", base::FEATURE_DISABLED_BY_DEFAULT};
+const base::Feature kTestFeatureForBrowserTest2{
+ "TestFeatureForBrowserTest2", base::FEATURE_ENABLED_BY_DEFAULT};
+const base::Feature kTestFeatureForBrowserTest3{
+ "TestFeatureForBrowserTest3", base::FEATURE_DISABLED_BY_DEFAULT};
+const base::Feature kTestFeatureForBrowserTest4{
+ "TestFeatureForBrowserTest4", base::FEATURE_ENABLED_BY_DEFAULT};
+
+} // namespace
+
+class ContentBrowserTestScopedFeatureListTest : public ContentBrowserTest {
+ public:
+ void SetUp() override {
+ scoped_feature_list_.InitWithFeatures({kTestFeatureForBrowserTest3},
+ {kTestFeatureForBrowserTest4});
+ ContentBrowserTest::SetUp();
+ }
+
+ private:
+ base::test::ScopedFeatureList scoped_feature_list_;
+};
+
+IN_PROC_BROWSER_TEST_F(ContentBrowserTestScopedFeatureListTest,
+ FeatureListTest) {
+ EXPECT_TRUE(base::FeatureList::IsEnabled(kTestFeatureForBrowserTest1));
+ EXPECT_FALSE(base::FeatureList::IsEnabled(kTestFeatureForBrowserTest2));
+ EXPECT_TRUE(base::FeatureList::IsEnabled(kTestFeatureForBrowserTest3));
+ EXPECT_FALSE(base::FeatureList::IsEnabled(kTestFeatureForBrowserTest4));
+}
+
+namespace {
+
void CallbackChecker(bool* non_nested_task_ran) {
*non_nested_task_ran = true;
}
« base/test/test_suite.cc ('K') | « chrome/test/base/test_launcher_utils.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698