| OLD | NEW |
| 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 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 return impl_->Wait(); | 115 return impl_->Wait(); |
| 116 } | 116 } |
| 117 | 117 |
| 118 // ----------------------------------------------------------------------------- | 118 // ----------------------------------------------------------------------------- |
| 119 | 119 |
| 120 void NotificationsTest::SetUpDefaultCommandLine( | 120 void NotificationsTest::SetUpDefaultCommandLine( |
| 121 base::CommandLine* command_line) { | 121 base::CommandLine* command_line) { |
| 122 InProcessBrowserTest::SetUpDefaultCommandLine(command_line); | 122 InProcessBrowserTest::SetUpDefaultCommandLine(command_line); |
| 123 // Temporary change while the whole support class is changed to deal | 123 // Temporary change while the whole support class is changed to deal |
| 124 // with native notifications. crbug.com/714679 | 124 // with native notifications. crbug.com/714679 |
| 125 #if defined(OS_MACOSX) | 125 #if BUILDFLAG(ENABLE_NATIVE_NOTIFICATIONS) |
| 126 command_line->AppendSwitchASCII(switches::kDisableFeatures, | 126 command_line->AppendSwitchASCII(switches::kDisableFeatures, |
| 127 features::kNativeNotifications.name); | 127 features::kNativeNotifications.name); |
| 128 #endif | 128 #endif // BUILDFLAG(ENABLE_NATIVE_NOTIFICATIONS) |
| 129 } | 129 } |
| 130 | 130 |
| 131 int NotificationsTest::GetNotificationCount() { | 131 int NotificationsTest::GetNotificationCount() { |
| 132 return message_center::MessageCenter::Get()->NotificationCount(); | 132 return message_center::MessageCenter::Get()->NotificationCount(); |
| 133 } | 133 } |
| 134 | 134 |
| 135 int NotificationsTest::GetNotificationPopupCount() { | 135 int NotificationsTest::GetNotificationPopupCount() { |
| 136 return message_center::MessageCenter::Get()->GetPopupNotifications().size(); | 136 return message_center::MessageCenter::Get()->GetPopupNotifications().size(); |
| 137 } | 137 } |
| 138 | 138 |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 287 GURL NotificationsTest::GetTestPageURL() const { | 287 GURL NotificationsTest::GetTestPageURL() const { |
| 288 return GetTestPageURLForFile("notification_tester.html"); | 288 return GetTestPageURLForFile("notification_tester.html"); |
| 289 } | 289 } |
| 290 | 290 |
| 291 content::WebContents* NotificationsTest::GetActiveWebContents( | 291 content::WebContents* NotificationsTest::GetActiveWebContents( |
| 292 Browser* browser) { | 292 Browser* browser) { |
| 293 return browser->tab_strip_model()->GetActiveWebContents(); | 293 return browser->tab_strip_model()->GetActiveWebContents(); |
| 294 } | 294 } |
| 295 | 295 |
| 296 void NotificationsTest::EnableFullscreenNotifications() { | 296 void NotificationsTest::EnableFullscreenNotifications() { |
| 297 #if BUILDFLAG(ENABLE_NATIVE_NOTIFICATIONS) |
| 298 feature_list_.InitWithFeatures( |
| 299 {features::kPreferHtmlOverPlugins, |
| 300 features::kAllowFullscreenWebNotificationsFeature}, |
| 301 {features::kNativeNotifications}); |
| 302 #else |
| 297 feature_list_.InitWithFeatures( | 303 feature_list_.InitWithFeatures( |
| 298 {features::kPreferHtmlOverPlugins, | 304 {features::kPreferHtmlOverPlugins, |
| 299 features::kAllowFullscreenWebNotificationsFeature}, | 305 features::kAllowFullscreenWebNotificationsFeature}, |
| 300 {}); | 306 {}); |
| 307 #endif // BUILDFLAG(ENABLE_NATIVE_NOTIFICATIONS) |
| 301 } | 308 } |
| 302 | 309 |
| 303 void NotificationsTest::DisableFullscreenNotifications() { | 310 void NotificationsTest::DisableFullscreenNotifications() { |
| 311 #if BUILDFLAG(ENABLE_NATIVE_NOTIFICATIONS) |
| 312 feature_list_.InitWithFeatures( |
| 313 {features::kPreferHtmlOverPlugins}, |
| 314 {features::kAllowFullscreenWebNotificationsFeature, |
| 315 features::kNativeNotifications}); |
| 316 #else |
| 304 feature_list_.InitWithFeatures( | 317 feature_list_.InitWithFeatures( |
| 305 {features::kPreferHtmlOverPlugins}, | 318 {features::kPreferHtmlOverPlugins}, |
| 306 {features::kAllowFullscreenWebNotificationsFeature}); | 319 {features::kAllowFullscreenWebNotificationsFeature}); |
| 320 #endif // BUILDFLAG(ENABLE_NATIVE_NOTIFICATIONS) |
| 307 } | 321 } |
| 308 | 322 |
| 309 void NotificationsTest::DropOriginPreference(const GURL& origin) { | 323 void NotificationsTest::DropOriginPreference(const GURL& origin) { |
| 310 DesktopNotificationProfileUtil::ClearSetting(browser()->profile(), origin); | 324 DesktopNotificationProfileUtil::ClearSetting(browser()->profile(), origin); |
| 311 } | 325 } |
| OLD | NEW |