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 "components/content_settings/core/common/content_settings.h" |
18 #include "content/public/common/content_switches.h" | 19 #include "content/public/common/content_switches.h" |
19 #include "content/public/test/browser_test_utils.h" | 20 #include "content/public/test/browser_test_utils.h" |
20 #include "ui/message_center/message_center.h" | 21 #include "ui/message_center/message_center.h" |
21 #include "ui/message_center/message_center_observer.h" | 22 #include "ui/message_center/message_center_observer.h" |
22 | 23 |
23 namespace { | 24 namespace { |
24 | 25 |
25 // Used to observe the creation of permission prompt without responding. | 26 // Used to observe the creation of permission prompt without responding. |
26 class PermissionRequestObserver : public PermissionRequestManager::Observer { | 27 class PermissionRequestObserver : public PermissionRequestManager::Observer { |
27 public: | 28 public: |
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
261 return observer.Wait(); | 262 return observer.Wait(); |
262 } | 263 } |
263 | 264 |
264 void NotificationsTest::GetPrefsByContentSetting( | 265 void NotificationsTest::GetPrefsByContentSetting( |
265 ContentSetting setting, | 266 ContentSetting setting, |
266 ContentSettingsForOneType* settings) { | 267 ContentSettingsForOneType* settings) { |
267 DesktopNotificationProfileUtil::GetNotificationsSettings(browser()->profile(), | 268 DesktopNotificationProfileUtil::GetNotificationsSettings(browser()->profile(), |
268 settings); | 269 settings); |
269 for (ContentSettingsForOneType::iterator it = settings->begin(); | 270 for (ContentSettingsForOneType::iterator it = settings->begin(); |
270 it != settings->end();) { | 271 it != settings->end();) { |
271 if (it->setting != setting || it->source.compare("preference") != 0) | 272 if (it->GetContentSetting() != setting || |
| 273 it->source.compare("preference") != 0) { |
272 it = settings->erase(it); | 274 it = settings->erase(it); |
273 else | 275 } else { |
274 ++it; | 276 ++it; |
| 277 } |
275 } | 278 } |
276 } | 279 } |
277 | 280 |
278 bool NotificationsTest::CheckOriginInSetting( | 281 bool NotificationsTest::CheckOriginInSetting( |
279 const ContentSettingsForOneType& settings, | 282 const ContentSettingsForOneType& settings, |
280 const GURL& origin) { | 283 const GURL& origin) { |
281 ContentSettingsPattern pattern = | 284 ContentSettingsPattern pattern = |
282 ContentSettingsPattern::FromURLNoWildcard(origin); | 285 ContentSettingsPattern::FromURLNoWildcard(origin); |
283 for (const auto& setting : settings) { | 286 for (const auto& setting : settings) { |
284 if (setting.primary_pattern == pattern) | 287 if (setting.primary_pattern == pattern) |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
340 #else | 343 #else |
341 scoped_feature_list->InitWithFeatures( | 344 scoped_feature_list->InitWithFeatures( |
342 {features::kPreferHtmlOverPlugins}, | 345 {features::kPreferHtmlOverPlugins}, |
343 {features::kAllowFullscreenWebNotificationsFeature}); | 346 {features::kAllowFullscreenWebNotificationsFeature}); |
344 #endif // BUILDFLAG(ENABLE_NATIVE_NOTIFICATIONS) | 347 #endif // BUILDFLAG(ENABLE_NATIVE_NOTIFICATIONS) |
345 } | 348 } |
346 | 349 |
347 void NotificationsTest::DropOriginPreference(const GURL& origin) { | 350 void NotificationsTest::DropOriginPreference(const GURL& origin) { |
348 DesktopNotificationProfileUtil::ClearSetting(browser()->profile(), origin); | 351 DesktopNotificationProfileUtil::ClearSetting(browser()->profile(), origin); |
349 } | 352 } |
OLD | NEW |