OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "content/shell/browser/layout_test/layout_test_notification_manager.h" | 5 #include "content/shell/browser/layout_test/layout_test_notification_manager.h" |
6 | 6 |
7 #include "base/guid.h" | 7 #include "base/guid.h" |
8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
9 #include "content/public/browser/browser_thread.h" | 9 #include "content/public/browser/browser_thread.h" |
10 #include "content/public/browser/desktop_notification_delegate.h" | 10 #include "content/public/browser/desktop_notification_delegate.h" |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 int64_t persistent_notification_id) { | 90 int64_t persistent_notification_id) { |
91 for (const auto& iter : persistent_notifications_) { | 91 for (const auto& iter : persistent_notifications_) { |
92 if (iter.second.persistent_id != persistent_notification_id) | 92 if (iter.second.persistent_id != persistent_notification_id) |
93 continue; | 93 continue; |
94 | 94 |
95 persistent_notifications_.erase(iter.first); | 95 persistent_notifications_.erase(iter.first); |
96 return; | 96 return; |
97 } | 97 } |
98 } | 98 } |
99 | 99 |
| 100 bool LayoutTestNotificationManager::GetDisplayedPersistentNotifications( |
| 101 BrowserContext* browser_context, |
| 102 std::set<std::string>* displayed_notifications) { |
| 103 DCHECK(displayed_notifications); |
| 104 |
| 105 // Notifications will never outlive the lifetime of running layout tests. |
| 106 return false; |
| 107 } |
| 108 |
100 void LayoutTestNotificationManager::SimulateClick(const std::string& title) { | 109 void LayoutTestNotificationManager::SimulateClick(const std::string& title) { |
101 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 110 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
102 | 111 |
103 // First check for page-notifications with the given title. | 112 // First check for page-notifications with the given title. |
104 const auto& page_iterator = page_notifications_.find(title); | 113 const auto& page_iterator = page_notifications_.find(title); |
105 if (page_iterator != page_notifications_.end()) { | 114 if (page_iterator != page_notifications_.end()) { |
106 page_iterator->second->NotificationClick(); | 115 page_iterator->second->NotificationClick(); |
107 return; | 116 return; |
108 } | 117 } |
109 | 118 |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
183 LayoutTestNotificationManager::CheckPermission(const GURL& origin) { | 192 LayoutTestNotificationManager::CheckPermission(const GURL& origin) { |
184 return ToWebNotificationPermission(LayoutTestContentBrowserClient::Get() | 193 return ToWebNotificationPermission(LayoutTestContentBrowserClient::Get() |
185 ->GetLayoutTestBrowserContext() | 194 ->GetLayoutTestBrowserContext() |
186 ->GetLayoutTestPermissionManager() | 195 ->GetLayoutTestPermissionManager() |
187 ->GetPermissionStatus(PermissionType::NOTIFICATIONS, | 196 ->GetPermissionStatus(PermissionType::NOTIFICATIONS, |
188 origin, | 197 origin, |
189 origin)); | 198 origin)); |
190 } | 199 } |
191 | 200 |
192 } // namespace content | 201 } // namespace content |
OLD | NEW |