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" |
11 #include "chrome/browser/notifications/web_notification_delegate.h" | 11 #include "chrome/browser/notifications/web_notification_delegate.h" |
12 #include "chrome/browser/permissions/permission_request_manager.h" | 12 #include "chrome/browser/permissions/permission_request_manager.h" |
13 #include "chrome/browser/ui/browser_window.h" | 13 #include "chrome/browser/ui/browser_window.h" |
14 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 14 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
15 #include "chrome/common/chrome_features.h" | 15 #include "chrome/common/chrome_features.h" |
16 #include "chrome/test/base/ui_test_utils.h" | 16 #include "chrome/test/base/ui_test_utils.h" |
17 #include "components/content_settings/core/browser/host_content_settings_map.h" | 17 #include "components/content_settings/core/browser/host_content_settings_map.h" |
| 18 #include "content/public/common/content_switches.h" |
18 #include "content/public/test/browser_test_utils.h" | 19 #include "content/public/test/browser_test_utils.h" |
19 #include "ui/message_center/message_center.h" | 20 #include "ui/message_center/message_center.h" |
20 #include "ui/message_center/message_center_observer.h" | 21 #include "ui/message_center/message_center_observer.h" |
21 | 22 |
22 namespace { | 23 namespace { |
23 | 24 |
24 // Used to observe the creation of permission prompt without responding. | 25 // Used to observe the creation of permission prompt without responding. |
25 class PermissionRequestObserver : public PermissionRequestManager::Observer { | 26 class PermissionRequestObserver : public PermissionRequestManager::Observer { |
26 public: | 27 public: |
27 explicit PermissionRequestObserver(content::WebContents* web_contents) | 28 explicit PermissionRequestObserver(content::WebContents* web_contents) |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 | 110 |
110 MessageCenterChangeObserver::MessageCenterChangeObserver() : impl_(new Impl) {} | 111 MessageCenterChangeObserver::MessageCenterChangeObserver() : impl_(new Impl) {} |
111 MessageCenterChangeObserver::~MessageCenterChangeObserver() = default; | 112 MessageCenterChangeObserver::~MessageCenterChangeObserver() = default; |
112 | 113 |
113 bool MessageCenterChangeObserver::Wait() { | 114 bool MessageCenterChangeObserver::Wait() { |
114 return impl_->Wait(); | 115 return impl_->Wait(); |
115 } | 116 } |
116 | 117 |
117 // ----------------------------------------------------------------------------- | 118 // ----------------------------------------------------------------------------- |
118 | 119 |
| 120 void NotificationsTest::SetUpDefaultCommandLine( |
| 121 base::CommandLine* command_line) { |
| 122 InProcessBrowserTest::SetUpDefaultCommandLine(command_line); |
| 123 // Temporary change while the whole support class is changed to deal |
| 124 // with native notifications. crbug.com/714679 |
| 125 #if defined(OS_MACOSX) |
| 126 command_line->AppendSwitchASCII(switches::kDisableFeatures, |
| 127 features::kNativeNotifications.name); |
| 128 #endif |
| 129 } |
| 130 |
119 int NotificationsTest::GetNotificationCount() { | 131 int NotificationsTest::GetNotificationCount() { |
120 return message_center::MessageCenter::Get()->NotificationCount(); | 132 return message_center::MessageCenter::Get()->NotificationCount(); |
121 } | 133 } |
122 | 134 |
123 int NotificationsTest::GetNotificationPopupCount() { | 135 int NotificationsTest::GetNotificationPopupCount() { |
124 return message_center::MessageCenter::Get()->GetPopupNotifications().size(); | 136 return message_center::MessageCenter::Get()->GetPopupNotifications().size(); |
125 } | 137 } |
126 | 138 |
127 void NotificationsTest::CloseBrowserWindow(Browser* browser) { | 139 void NotificationsTest::CloseBrowserWindow(Browser* browser) { |
128 content::WindowedNotificationObserver observer( | 140 content::WindowedNotificationObserver observer( |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
290 | 302 |
291 void NotificationsTest::DisableFullscreenNotifications() { | 303 void NotificationsTest::DisableFullscreenNotifications() { |
292 feature_list_.InitWithFeatures( | 304 feature_list_.InitWithFeatures( |
293 {features::kPreferHtmlOverPlugins}, | 305 {features::kPreferHtmlOverPlugins}, |
294 {features::kAllowFullscreenWebNotificationsFeature}); | 306 {features::kAllowFullscreenWebNotificationsFeature}); |
295 } | 307 } |
296 | 308 |
297 void NotificationsTest::DropOriginPreference(const GURL& origin) { | 309 void NotificationsTest::DropOriginPreference(const GURL& origin) { |
298 DesktopNotificationProfileUtil::ClearSetting(browser()->profile(), origin); | 310 DesktopNotificationProfileUtil::ClearSetting(browser()->profile(), origin); |
299 } | 311 } |
OLD | NEW |