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

Side by Side Diff: chrome/browser/notifications/notification_interactive_uitest_support.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 unified diff | Download patch
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/notifications/notification_interactive_uitest_support.h " 5 #include "chrome/browser/notifications/notification_interactive_uitest_support.h "
6 6
7 #include "base/run_loop.h" 7 #include "base/run_loop.h"
8 #include "chrome/browser/chrome_notification_types.h" 8 #include "chrome/browser/chrome_notification_types.h"
9 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" 9 #include "chrome/browser/content_settings/host_content_settings_map_factory.h"
10 #include "chrome/browser/notifications/desktop_notification_profile_util.h" 10 #include "chrome/browser/notifications/desktop_notification_profile_util.h"
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 111
112 MessageCenterChangeObserver::MessageCenterChangeObserver() : impl_(new Impl) {} 112 MessageCenterChangeObserver::MessageCenterChangeObserver() : impl_(new Impl) {}
113 MessageCenterChangeObserver::~MessageCenterChangeObserver() = default; 113 MessageCenterChangeObserver::~MessageCenterChangeObserver() = default;
114 114
115 bool MessageCenterChangeObserver::Wait() { 115 bool MessageCenterChangeObserver::Wait() {
116 return impl_->Wait(); 116 return impl_->Wait();
117 } 117 }
118 118
119 // ----------------------------------------------------------------------------- 119 // -----------------------------------------------------------------------------
120 120
121 void NotificationsTest::SetUpDefaultCommandLine( 121 NotificationsTest::NotificationsTest() {
122 base::CommandLine* command_line) {
123 InProcessBrowserTest::SetUpDefaultCommandLine(command_line);
124 // Temporary change while the whole support class is changed to deal 122 // Temporary change while the whole support class is changed to deal
125 // with native notifications. crbug.com/714679 123 // with native notifications. crbug.com/714679
126 #if BUILDFLAG(ENABLE_NATIVE_NOTIFICATIONS) 124 #if BUILDFLAG(ENABLE_NATIVE_NOTIFICATIONS)
127 feature_list_.InitAndDisableFeature(features::kNativeNotifications); 125 feature_list_.InitAndDisableFeature(features::kNativeNotifications);
128 #endif // BUILDFLAG(ENABLE_NATIVE_NOTIFICATIONS) 126 #endif // BUILDFLAG(ENABLE_NATIVE_NOTIFICATIONS)
129 } 127 }
130 128
131 int NotificationsTest::GetNotificationCount() { 129 int NotificationsTest::GetNotificationCount() {
132 return message_center::MessageCenter::Get()->NotificationCount(); 130 return message_center::MessageCenter::Get()->NotificationCount();
133 } 131 }
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
298 return GetTestPageURLForFile("notification_tester.html"); 296 return GetTestPageURLForFile("notification_tester.html");
299 } 297 }
300 298
301 content::WebContents* NotificationsTest::GetActiveWebContents( 299 content::WebContents* NotificationsTest::GetActiveWebContents(
302 Browser* browser) { 300 Browser* browser) {
303 return browser->tab_strip_model()->GetActiveWebContents(); 301 return browser->tab_strip_model()->GetActiveWebContents();
304 } 302 }
305 303
306 void NotificationsTest::EnablePermissionsEmbargo( 304 void NotificationsTest::EnablePermissionsEmbargo(
307 base::test::ScopedFeatureList* scoped_feature_list) { 305 base::test::ScopedFeatureList* scoped_feature_list) {
308 #if BUILDFLAG(ENABLE_NATIVE_NOTIFICATIONS)
309 scoped_feature_list->InitWithFeatures(
310 {features::kBlockPromptsIfDismissedOften,
311 features::kBlockPromptsIfIgnoredOften},
312 {features::kNativeNotifications});
313 #else
314 scoped_feature_list->InitWithFeatures( 306 scoped_feature_list->InitWithFeatures(
315 {features::kBlockPromptsIfDismissedOften, 307 {features::kBlockPromptsIfDismissedOften,
316 features::kBlockPromptsIfIgnoredOften}, 308 features::kBlockPromptsIfIgnoredOften},
317 {}); 309 {});
318 #endif // BUILDFLAG(ENABLE_NATIVE_NOTIFICATIONS)
319 } 310 }
320 311
321 void NotificationsTest::EnableFullscreenNotifications( 312 void NotificationsTest::EnableFullscreenNotifications(
322 base::test::ScopedFeatureList* scoped_feature_list) { 313 base::test::ScopedFeatureList* scoped_feature_list) {
323 #if BUILDFLAG(ENABLE_NATIVE_NOTIFICATIONS)
324 scoped_feature_list->InitWithFeatures(
325 {features::kPreferHtmlOverPlugins,
326 features::kAllowFullscreenWebNotificationsFeature},
327 {features::kNativeNotifications});
328 #else
329 scoped_feature_list->InitWithFeatures( 314 scoped_feature_list->InitWithFeatures(
330 {features::kPreferHtmlOverPlugins, 315 {features::kPreferHtmlOverPlugins,
331 features::kAllowFullscreenWebNotificationsFeature}, 316 features::kAllowFullscreenWebNotificationsFeature},
332 {}); 317 {});
333 #endif // BUILDFLAG(ENABLE_NATIVE_NOTIFICATIONS)
334 } 318 }
335 319
336 void NotificationsTest::DisableFullscreenNotifications( 320 void NotificationsTest::DisableFullscreenNotifications(
337 base::test::ScopedFeatureList* scoped_feature_list) { 321 base::test::ScopedFeatureList* scoped_feature_list) {
338 #if BUILDFLAG(ENABLE_NATIVE_NOTIFICATIONS)
339 scoped_feature_list->InitWithFeatures(
340 {features::kPreferHtmlOverPlugins},
341 {features::kAllowFullscreenWebNotificationsFeature,
342 features::kNativeNotifications});
343 #else
344 scoped_feature_list->InitWithFeatures( 322 scoped_feature_list->InitWithFeatures(
345 {features::kPreferHtmlOverPlugins}, 323 {features::kPreferHtmlOverPlugins},
346 {features::kAllowFullscreenWebNotificationsFeature}); 324 {features::kAllowFullscreenWebNotificationsFeature});
347 #endif // BUILDFLAG(ENABLE_NATIVE_NOTIFICATIONS)
348 } 325 }
349 326
350 void NotificationsTest::DropOriginPreference(const GURL& origin) { 327 void NotificationsTest::DropOriginPreference(const GURL& origin) {
351 DesktopNotificationProfileUtil::ClearSetting(browser()->profile(), origin); 328 DesktopNotificationProfileUtil::ClearSetting(browser()->profile(), origin);
352 } 329 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698