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 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 return false; | 106 return false; |
107 } | 107 } |
108 | 108 |
109 void LayoutTestNotificationManager::SimulateClick(const std::string& title, | 109 void LayoutTestNotificationManager::SimulateClick(const std::string& title, |
110 int action_index) { | 110 int action_index) { |
111 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 111 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
112 | 112 |
113 // First check for page-notifications with the given title. | 113 // First check for page-notifications with the given title. |
114 const auto& page_iterator = page_notifications_.find(title); | 114 const auto& page_iterator = page_notifications_.find(title); |
115 if (page_iterator != page_notifications_.end()) { | 115 if (page_iterator != page_notifications_.end()) { |
116 // TODO(johnme): Implement this. | 116 page_iterator->second->NotificationClick(action_index); |
117 CHECK(action_index < 0) << "Simulating action clicks for page notifications" | |
118 << " is not yet implemented"; | |
119 page_iterator->second->NotificationClick(); | |
120 return; | 117 return; |
121 } | 118 } |
122 | 119 |
123 // Then check for persistent notifications with the given title. | 120 // Then check for persistent notifications with the given title. |
124 const auto& persistent_iterator = persistent_notifications_.find(title); | 121 const auto& persistent_iterator = persistent_notifications_.find(title); |
125 if (persistent_iterator == persistent_notifications_.end()) | 122 if (persistent_iterator == persistent_notifications_.end()) |
126 return; | 123 return; |
127 | 124 |
128 const PersistentNotification& notification = persistent_iterator->second; | 125 const PersistentNotification& notification = persistent_iterator->second; |
129 content::NotificationEventDispatcher::GetInstance() | 126 content::NotificationEventDispatcher::GetInstance() |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
197 LayoutTestNotificationManager::CheckPermission(const GURL& origin) { | 194 LayoutTestNotificationManager::CheckPermission(const GURL& origin) { |
198 return ToWebNotificationPermission(LayoutTestContentBrowserClient::Get() | 195 return ToWebNotificationPermission(LayoutTestContentBrowserClient::Get() |
199 ->GetLayoutTestBrowserContext() | 196 ->GetLayoutTestBrowserContext() |
200 ->GetLayoutTestPermissionManager() | 197 ->GetLayoutTestPermissionManager() |
201 ->GetPermissionStatus(PermissionType::NOTIFICATIONS, | 198 ->GetPermissionStatus(PermissionType::NOTIFICATIONS, |
202 origin, | 199 origin, |
203 origin)); | 200 origin)); |
204 } | 201 } |
205 | 202 |
206 } // namespace content | 203 } // namespace content |
OLD | NEW |