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

Unified Diff: chrome/browser/notifications/platform_notification_service_interactive_uitest.cc

Issue 2910843002: [Cleanup] Move all browsertests to use ScopedFeatureList to modify features
Patch Set: Move SFL calls to constructor Created 3 years, 5 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
Index: chrome/browser/notifications/platform_notification_service_interactive_uitest.cc
diff --git a/chrome/browser/notifications/platform_notification_service_interactive_uitest.cc b/chrome/browser/notifications/platform_notification_service_interactive_uitest.cc
index 21a04dc228bc832783167fb48782ccd0aee8cdbc..72ae93e637d599d2e08239692d5a186a0f4267bc 100644
--- a/chrome/browser/notifications/platform_notification_service_interactive_uitest.cc
+++ b/chrome/browser/notifications/platform_notification_service_interactive_uitest.cc
@@ -88,8 +88,10 @@ class PlatformNotificationServiceBrowserTest : public InProcessBrowserTest {
bool RequestAndAcceptPermission();
bool RequestAndDenyPermission();
- void EnableFullscreenNotifications();
- void DisableFullscreenNotifications();
+ void EnableFullscreenNotifications(
+ base::test::ScopedFeatureList* scoped_feature_list);
+ void DisableFullscreenNotifications(
+ base::test::ScopedFeatureList* scoped_feature_list);
double GetEngagementScore(const GURL& origin) const;
GURL GetLastCommittedURL() const;
@@ -144,13 +146,6 @@ void PlatformNotificationServiceBrowserTest::SetUpDefaultCommandLine(
// Needed for the Reply button tests
command_line->AppendSwitch(switches::kEnableExperimentalWebPlatformFeatures);
-
-#if BUILDFLAG(ENABLE_NATIVE_NOTIFICATIONS)
- // TODO(crbug.com/714679): Temporary change while tests are upgraded to deal
- // with native notifications.
- command_line->AppendSwitchASCII(switches::kDisableFeatures,
- features::kNativeNotifications.name);
-#endif // BUILDFLAG(ENABLE_NATIVE_NOTIFICATIONS)
}
void PlatformNotificationServiceBrowserTest::SetUp() {
@@ -159,6 +154,11 @@ void PlatformNotificationServiceBrowserTest::SetUp() {
new net::EmbeddedTestServer(net::EmbeddedTestServer::TYPE_HTTPS));
https_server_->ServeFilesFromSourceDirectory(server_root_);
ASSERT_TRUE(https_server_->Start());
+#if BUILDFLAG(ENABLE_NATIVE_NOTIFICATIONS)
+ // TODO(crbug.com/714679): Temporary change while tests are upgraded to deal
+ // with native notifications.
+ feature_list_.InitAndDisableFeature(features::kNativeNotifications);
+#endif // BUILDFLAG(ENABLE_NATIVE_NOTIFICATIONS)
InProcessBrowserTest::SetUp();
}
@@ -232,14 +232,17 @@ bool PlatformNotificationServiceBrowserTest::RequestAndDenyPermission() {
return "denied" == result;
}
-void PlatformNotificationServiceBrowserTest::EnableFullscreenNotifications() {
- feature_list_.InitWithFeatures({
- features::kPreferHtmlOverPlugins,
- features::kAllowFullscreenWebNotificationsFeature}, {});
+void PlatformNotificationServiceBrowserTest::EnableFullscreenNotifications(
+ base::test::ScopedFeatureList* scoped_feature_list) {
+ scoped_feature_list->InitWithFeatures(
+ {features::kPreferHtmlOverPlugins,
+ features::kAllowFullscreenWebNotificationsFeature},
+ {});
}
-void PlatformNotificationServiceBrowserTest::DisableFullscreenNotifications() {
- feature_list_.InitWithFeatures(
+void PlatformNotificationServiceBrowserTest::DisableFullscreenNotifications(
+ base::test::ScopedFeatureList* scoped_feature_list) {
+ scoped_feature_list->InitWithFeatures(
{features::kPreferHtmlOverPlugins},
{features::kAllowFullscreenWebNotificationsFeature});
}
@@ -700,7 +703,8 @@ IN_PROC_BROWSER_TEST_F(PlatformNotificationServiceBrowserTest,
IN_PROC_BROWSER_TEST_F(PlatformNotificationServiceBrowserTest,
TestShouldDisplayNormal) {
ASSERT_NO_FATAL_FAILURE(GrantNotificationPermissionForTest());
- EnableFullscreenNotifications();
+ base::test::ScopedFeatureList scoped_feature_list;
+ EnableFullscreenNotifications(&scoped_feature_list);
std::string script_result;
ASSERT_TRUE(RunScript(
@@ -718,7 +722,8 @@ IN_PROC_BROWSER_TEST_F(PlatformNotificationServiceBrowserTest,
ui::test::ScopedFakeNSWindowFullscreen fake_fullscreen;
#endif
ASSERT_NO_FATAL_FAILURE(GrantNotificationPermissionForTest());
- EnableFullscreenNotifications();
+ base::test::ScopedFeatureList scoped_feature_list;
+ EnableFullscreenNotifications(&scoped_feature_list);
std::string script_result;
ASSERT_TRUE(RunScript(
@@ -751,7 +756,8 @@ IN_PROC_BROWSER_TEST_F(PlatformNotificationServiceBrowserTest,
ui::test::ScopedFakeNSWindowFullscreen fake_fullscreen;
#endif
ASSERT_NO_FATAL_FAILURE(GrantNotificationPermissionForTest());
- DisableFullscreenNotifications();
+ base::test::ScopedFeatureList scoped_feature_list;
+ DisableFullscreenNotifications(&scoped_feature_list);
std::string script_result;
ASSERT_TRUE(RunScript(
@@ -786,7 +792,8 @@ IN_PROC_BROWSER_TEST_F(PlatformNotificationServiceBrowserTest,
IN_PROC_BROWSER_TEST_F(PlatformNotificationServiceBrowserTest,
TestShouldDisplayMultiFullscreen) {
ASSERT_NO_FATAL_FAILURE(GrantNotificationPermissionForTest());
- EnableFullscreenNotifications();
+ base::test::ScopedFeatureList scoped_feature_list;
+ EnableFullscreenNotifications(&scoped_feature_list);
Browser* other_browser = CreateBrowser(browser()->profile());
ui_test_utils::NavigateToURL(other_browser, GURL("about:blank"));

Powered by Google App Engine
This is Rietveld 408576698