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

Side by Side Diff: chrome/browser/notifications/notification_interactive_uitest_support.cc

Issue 2938163002: Store base::Value in ContentSettingPatternSource instead of an enum (Closed)
Patch Set: nasko comments 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"
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 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 return observer.Wait(); 263 return observer.Wait();
263 } 264 }
264 265
265 void NotificationsTest::GetPrefsByContentSetting( 266 void NotificationsTest::GetPrefsByContentSetting(
266 ContentSetting setting, 267 ContentSetting setting,
267 ContentSettingsForOneType* settings) { 268 ContentSettingsForOneType* settings) {
268 DesktopNotificationProfileUtil::GetNotificationsSettings(browser()->profile(), 269 DesktopNotificationProfileUtil::GetNotificationsSettings(browser()->profile(),
269 settings); 270 settings);
270 for (ContentSettingsForOneType::iterator it = settings->begin(); 271 for (ContentSettingsForOneType::iterator it = settings->begin();
271 it != settings->end();) { 272 it != settings->end();) {
272 if (it->setting != setting || it->source.compare("preference") != 0) 273 if (it->GetContentSetting() != setting ||
274 it->source.compare("preference") != 0) {
273 it = settings->erase(it); 275 it = settings->erase(it);
274 else 276 } else {
275 ++it; 277 ++it;
278 }
276 } 279 }
277 } 280 }
278 281
279 bool NotificationsTest::CheckOriginInSetting( 282 bool NotificationsTest::CheckOriginInSetting(
280 const ContentSettingsForOneType& settings, 283 const ContentSettingsForOneType& settings,
281 const GURL& origin) { 284 const GURL& origin) {
282 ContentSettingsPattern pattern = 285 ContentSettingsPattern pattern =
283 ContentSettingsPattern::FromURLNoWildcard(origin); 286 ContentSettingsPattern::FromURLNoWildcard(origin);
284 for (const auto& setting : settings) { 287 for (const auto& setting : settings) {
285 if (setting.primary_pattern == pattern) 288 if (setting.primary_pattern == pattern)
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
330 #else 333 #else
331 feature_list_.InitWithFeatures( 334 feature_list_.InitWithFeatures(
332 {features::kPreferHtmlOverPlugins}, 335 {features::kPreferHtmlOverPlugins},
333 {features::kAllowFullscreenWebNotificationsFeature}); 336 {features::kAllowFullscreenWebNotificationsFeature});
334 #endif // BUILDFLAG(ENABLE_NATIVE_NOTIFICATIONS) 337 #endif // BUILDFLAG(ENABLE_NATIVE_NOTIFICATIONS)
335 } 338 }
336 339
337 void NotificationsTest::DropOriginPreference(const GURL& origin) { 340 void NotificationsTest::DropOriginPreference(const GURL& origin) {
338 DesktopNotificationProfileUtil::ClearSetting(browser()->profile(), origin); 341 DesktopNotificationProfileUtil::ClearSetting(browser()->profile(), origin);
339 } 342 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698