| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 <string> | 5 #include <string> |
| 6 | 6 |
| 7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
| 8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
| 9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
| 10 #include "chrome/browser/notifications/notification.h" | 10 #include "chrome/browser/notifications/notification.h" |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 // Adds a notification to be displayed. Virtual for unit test override. | 51 // Adds a notification to be displayed. Virtual for unit test override. |
| 52 virtual void Add(const Notification& notification, Profile* profile) | 52 virtual void Add(const Notification& notification, Profile* profile) |
| 53 OVERRIDE { | 53 OVERRIDE { |
| 54 // Make a deep copy of the notification that we can inspect. | 54 // Make a deep copy of the notification that we can inspect. |
| 55 notification_ = notification; | 55 notification_ = notification; |
| 56 profile_ = profile; | 56 profile_ = profile; |
| 57 } | 57 } |
| 58 | 58 |
| 59 // Returns true if any notifications match the supplied ID, either currently | 59 // Returns true if any notifications match the supplied ID, either currently |
| 60 // displayed or in the queue. | 60 // displayed or in the queue. |
| 61 virtual bool DoesIdExist(const std::string& id) OVERRIDE { | 61 virtual bool DoesIdExist(const std::string& id, |
| 62 Notification* matched_notification) OVERRIDE { |
| 62 return true; | 63 return true; |
| 63 } | 64 } |
| 64 | 65 |
| 65 // Removes any notifications matching the supplied ID, either currently | 66 // Removes any notifications matching the supplied ID, either currently |
| 66 // displayed or in the queue. Returns true if anything was removed. | 67 // displayed or in the queue. Returns true if anything was removed. |
| 67 virtual bool CancelById(const std::string& notification_id) OVERRIDE { | 68 virtual bool CancelById(const std::string& notification_id) OVERRIDE { |
| 68 dismissed_id_ = notification_id; | 69 dismissed_id_ = notification_id; |
| 69 return true; | 70 return true; |
| 70 } | 71 } |
| 71 | 72 |
| (...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 415 | 416 |
| 416 notification1_->QueueBitmapFetchJobs(¬ification_manager, NULL, NULL); | 417 notification1_->QueueBitmapFetchJobs(¬ification_manager, NULL, NULL); |
| 417 | 418 |
| 418 // There should be 4 urls in the queue, icon, image, and two buttons. | 419 // There should be 4 urls in the queue, icon, image, and two buttons. |
| 419 EXPECT_EQ(4, notification1_->active_fetcher_count_); | 420 EXPECT_EQ(4, notification1_->active_fetcher_count_); |
| 420 } | 421 } |
| 421 | 422 |
| 422 // TODO(petewil): Add a test for a notification being read and or deleted. | 423 // TODO(petewil): Add a test for a notification being read and or deleted. |
| 423 | 424 |
| 424 } // namespace notifier | 425 } // namespace notifier |
| OLD | NEW |