OLD | NEW |
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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 } | 46 } |
47 | 47 |
48 bool StubNotificationUIManager::Update(const Notification& notification, | 48 bool StubNotificationUIManager::Update(const Notification& notification, |
49 Profile* profile) { | 49 Profile* profile) { |
50 return false; | 50 return false; |
51 } | 51 } |
52 | 52 |
53 const Notification* StubNotificationUIManager::FindById( | 53 const Notification* StubNotificationUIManager::FindById( |
54 const std::string& delegate_id, | 54 const std::string& delegate_id, |
55 ProfileID profile_id) const { | 55 ProfileID profile_id) const { |
| 56 auto iter = notifications_.begin(); |
| 57 for (; iter != notifications_.end(); ++iter) { |
| 58 if (iter->first.delegate_id() != delegate_id || iter->second != profile_id) |
| 59 continue; |
| 60 |
| 61 return &iter->first; |
| 62 } |
| 63 |
56 return nullptr; | 64 return nullptr; |
57 } | 65 } |
58 | 66 |
59 bool StubNotificationUIManager::CancelById(const std::string& delegate_id, | 67 bool StubNotificationUIManager::CancelById(const std::string& delegate_id, |
60 ProfileID profile_id) { | 68 ProfileID profile_id) { |
61 auto iter = notifications_.begin(); | 69 auto iter = notifications_.begin(); |
62 for (; iter != notifications_.end(); ++iter) { | 70 for (; iter != notifications_.end(); ++iter) { |
63 if (iter->first.delegate_id() != delegate_id || | 71 if (iter->first.delegate_id() != delegate_id || |
64 iter->second != profile_id) | 72 iter->second != profile_id) |
65 continue; | 73 continue; |
(...skipping 27 matching lines...) Expand all Loading... |
93 bool StubNotificationUIManager::CancelAllByProfile(ProfileID profile_id) { | 101 bool StubNotificationUIManager::CancelAllByProfile(ProfileID profile_id) { |
94 NOTIMPLEMENTED(); | 102 NOTIMPLEMENTED(); |
95 return false; | 103 return false; |
96 } | 104 } |
97 | 105 |
98 void StubNotificationUIManager::CancelAll() { | 106 void StubNotificationUIManager::CancelAll() { |
99 for (const auto& pair : notifications_) | 107 for (const auto& pair : notifications_) |
100 pair.first.delegate()->Close(false /* by_user */); | 108 pair.first.delegate()->Close(false /* by_user */); |
101 notifications_.clear(); | 109 notifications_.clear(); |
102 } | 110 } |
OLD | NEW |