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

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

Issue 1127013008: Beginnings of synchronizing notifications in the notification database. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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 (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 MockNotificationDelegate::MockNotificationDelegate(const std::string& id) 7 MockNotificationDelegate::MockNotificationDelegate(const std::string& id)
8 : id_(id) {} 8 : id_(id) {}
9 9
10 MockNotificationDelegate::~MockNotificationDelegate() {} 10 MockNotificationDelegate::~MockNotificationDelegate() {}
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 Profile* profile, 85 Profile* profile,
86 const GURL& source) { 86 const GURL& source) {
87 std::set<std::string> delegate_ids; 87 std::set<std::string> delegate_ids;
88 for (const auto& pair : notifications_) { 88 for (const auto& pair : notifications_) {
89 if (pair.second == profile && pair.first.origin_url() == source) 89 if (pair.second == profile && pair.first.origin_url() == source)
90 delegate_ids.insert(pair.first.delegate_id()); 90 delegate_ids.insert(pair.first.delegate_id());
91 } 91 }
92 return delegate_ids; 92 return delegate_ids;
93 } 93 }
94 94
95 std::set<std::string> StubNotificationUIManager::GetAllIdsByProfile(
96 Profile* profile) {
97 std::set<std::string> delegate_ids;
98 for (const auto& pair : notifications_) {
99 if (pair.second == profile)
100 delegate_ids.insert(pair.first.delegate_id());
101 }
102 return delegate_ids;
103 }
104
95 bool StubNotificationUIManager::CancelAllBySourceOrigin( 105 bool StubNotificationUIManager::CancelAllBySourceOrigin(
96 const GURL& source_origin) { 106 const GURL& source_origin) {
97 NOTIMPLEMENTED(); 107 NOTIMPLEMENTED();
98 return false; 108 return false;
99 } 109 }
100 110
101 bool StubNotificationUIManager::CancelAllByProfile(ProfileID profile_id) { 111 bool StubNotificationUIManager::CancelAllByProfile(ProfileID profile_id) {
102 NOTIMPLEMENTED(); 112 NOTIMPLEMENTED();
103 return false; 113 return false;
104 } 114 }
105 115
106 void StubNotificationUIManager::CancelAll() { 116 void StubNotificationUIManager::CancelAll() {
107 for (const auto& pair : notifications_) 117 for (const auto& pair : notifications_)
108 pair.first.delegate()->Close(false /* by_user */); 118 pair.first.delegate()->Close(false /* by_user */);
109 notifications_.clear(); 119 notifications_.clear();
110 } 120 }
OLDNEW
« no previous file with comments | « chrome/browser/notifications/notification_test_util.h ('k') | chrome/browser/notifications/notification_ui_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698