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

Side by Side Diff: content/shell/browser/layout_test/layout_test_notification_manager.cc

Issue 1656823002: Add layout tests for ServiceWorker's notificationclose event. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Refactored data reflection tests + nits Created 4 years, 10 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 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 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 const PersistentNotification& notification = persistent_iterator->second; 127 const PersistentNotification& notification = persistent_iterator->second;
128 content::NotificationEventDispatcher::GetInstance() 128 content::NotificationEventDispatcher::GetInstance()
129 ->DispatchNotificationClickEvent( 129 ->DispatchNotificationClickEvent(
130 notification.browser_context, 130 notification.browser_context,
131 notification.persistent_id, 131 notification.persistent_id,
132 notification.origin, 132 notification.origin,
133 action_index, 133 action_index,
134 base::Bind(&OnEventDispatchComplete)); 134 base::Bind(&OnEventDispatchComplete));
135 } 135 }
136 136
137 void LayoutTestNotificationManager::SimulateClose(const std::string& title,
138 bool by_user) {
139 DCHECK_CURRENTLY_ON(BrowserThread::UI);
140
141 const auto& persistent_iterator = persistent_notifications_.find(title);
142 if (persistent_iterator == persistent_notifications_.end())
143 return;
144
145 const PersistentNotification& notification = persistent_iterator->second;
146 content::NotificationEventDispatcher::GetInstance()
147 ->DispatchNotificationCloseEvent(
148 notification.browser_context,
149 notification.persistent_id,
150 notification.origin,
151 by_user,
152 base::Bind(&OnEventDispatchComplete));
153 }
154
137 blink::WebNotificationPermission 155 blink::WebNotificationPermission
138 LayoutTestNotificationManager::CheckPermissionOnUIThread( 156 LayoutTestNotificationManager::CheckPermissionOnUIThread(
139 BrowserContext* browser_context, 157 BrowserContext* browser_context,
140 const GURL& origin, 158 const GURL& origin,
141 int render_process_id) { 159 int render_process_id) {
142 DCHECK_CURRENTLY_ON(BrowserThread::UI); 160 DCHECK_CURRENTLY_ON(BrowserThread::UI);
143 return CheckPermission(origin); 161 return CheckPermission(origin);
144 } 162 }
145 163
146 blink::WebNotificationPermission 164 blink::WebNotificationPermission
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 LayoutTestNotificationManager::CheckPermission(const GURL& origin) { 214 LayoutTestNotificationManager::CheckPermission(const GURL& origin) {
197 return ToWebNotificationPermission(LayoutTestContentBrowserClient::Get() 215 return ToWebNotificationPermission(LayoutTestContentBrowserClient::Get()
198 ->GetLayoutTestBrowserContext() 216 ->GetLayoutTestBrowserContext()
199 ->GetLayoutTestPermissionManager() 217 ->GetLayoutTestPermissionManager()
200 ->GetPermissionStatus(PermissionType::NOTIFICATIONS, 218 ->GetPermissionStatus(PermissionType::NOTIFICATIONS,
201 origin, 219 origin,
202 origin)); 220 origin));
203 } 221 }
204 222
205 } // namespace content 223 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698