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

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

Issue 2534443002: Use notification display service to collect persistent notifications. (Closed)
Patch Set: revert unit test Created 4 years 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_test_util.h" 5 #include "chrome/browser/notifications/notification_test_util.h"
6 6
7 #include "chrome/browser/ui/browser.h" 7 #include "chrome/browser/ui/browser.h"
8 #include "chrome/browser/ui/exclusive_access/exclusive_access_context.h" 8 #include "chrome/browser/ui/exclusive_access/exclusive_access_context.h"
9 #include "chrome/browser/ui/exclusive_access/exclusive_access_manager.h" 9 #include "chrome/browser/ui/exclusive_access/exclusive_access_manager.h"
10 #include "content/public/test/test_utils.h" 10 #include "content/public/test/test_utils.h"
(...skipping 19 matching lines...) Expand all
30 unsigned int index) const { 30 unsigned int index) const {
31 DCHECK_GT(GetNotificationCount(), index); 31 DCHECK_GT(GetNotificationCount(), index);
32 return notifications_[index].first; 32 return notifications_[index].first;
33 } 33 }
34 34
35 void StubNotificationUIManager::SetNotificationAddedCallback( 35 void StubNotificationUIManager::SetNotificationAddedCallback(
36 const base::Closure& callback) { 36 const base::Closure& callback) {
37 notification_added_callback_ = callback; 37 notification_added_callback_ = callback;
38 } 38 }
39 39
40 bool StubNotificationUIManager::ClearNotificationById(
41 const std::string& delegate_id,
42 ProfileID profile_id) {
43 auto iter = notifications_.begin();
44 for (; iter != notifications_.end(); ++iter) {
45 if (iter->first.delegate_id() != delegate_id || iter->second != profile_id)
46 continue;
47 notifications_.erase(iter);
48 return true;
49 }
50 return false;
51 }
52
40 void StubNotificationUIManager::Add(const Notification& notification, 53 void StubNotificationUIManager::Add(const Notification& notification,
41 Profile* profile) { 54 Profile* profile) {
42 notifications_.push_back(std::make_pair( 55 notifications_.push_back(std::make_pair(
43 notification, NotificationUIManager::GetProfileID(profile))); 56 notification, NotificationUIManager::GetProfileID(profile)));
44 57
45 if (!notification_added_callback_.is_null()) { 58 if (!notification_added_callback_.is_null()) {
46 notification_added_callback_.Run(); 59 notification_added_callback_.Run();
47 notification_added_callback_.Reset(); 60 notification_added_callback_.Reset();
48 } 61 }
49 62
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 Browser* browser, bool desired_state) 158 Browser* browser, bool desired_state)
146 : browser_(browser), 159 : browser_(browser),
147 desired_state_(desired_state) {} 160 desired_state_(desired_state) {}
148 161
149 void FullscreenStateWaiter::Wait() { 162 void FullscreenStateWaiter::Wait() {
150 while (desired_state_ != 163 while (desired_state_ !=
151 browser_->exclusive_access_manager()->context()->IsFullscreen()) { 164 browser_->exclusive_access_manager()->context()->IsFullscreen()) {
152 content::RunAllPendingInMessageLoop(); 165 content::RunAllPendingInMessageLoop();
153 } 166 }
154 } 167 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698