OLD | NEW |
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 "chrome/browser/notifications/extension_welcome_notification.h" | 5 #include "chrome/browser/notifications/extension_welcome_notification.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
(...skipping 22 matching lines...) Expand all Loading... |
33 notifications_with_shown_as_popup_(0) { | 33 notifications_with_shown_as_popup_(0) { |
34 } | 34 } |
35 | 35 |
36 int add_notification_calls() { return add_notification_calls_; } | 36 int add_notification_calls() { return add_notification_calls_; } |
37 int remove_notification_calls() { return remove_notification_calls_; } | 37 int remove_notification_calls() { return remove_notification_calls_; } |
38 int notifications_with_shown_as_popup() { | 38 int notifications_with_shown_as_popup() { |
39 return notifications_with_shown_as_popup_; | 39 return notifications_with_shown_as_popup_; |
40 } | 40 } |
41 | 41 |
42 // message_center::FakeMessageCenter Overrides | 42 // message_center::FakeMessageCenter Overrides |
43 virtual bool HasNotification(const std::string& id) OVERRIDE { | 43 virtual message_center::Notification* FindVisibleNotificationById( |
44 return last_notification.get() && (last_notification->id() == id); | 44 const std::string& id) OVERRIDE { |
| 45 if (last_notification.get() && last_notification->id() == id) |
| 46 return last_notification.get(); |
| 47 return NULL; |
45 } | 48 } |
46 | 49 |
47 virtual void AddNotification( | 50 virtual void AddNotification( |
48 scoped_ptr<message_center::Notification> notification) OVERRIDE { | 51 scoped_ptr<message_center::Notification> notification) OVERRIDE { |
49 EXPECT_FALSE(last_notification.get()); | 52 EXPECT_FALSE(last_notification.get()); |
50 last_notification.swap(notification); | 53 last_notification.swap(notification); |
51 add_notification_calls_++; | 54 add_notification_calls_++; |
52 if (last_notification->shown_as_popup()) | 55 if (last_notification->shown_as_popup()) |
53 notifications_with_shown_as_popup_++; | 56 notifications_with_shown_as_popup_++; |
54 } | 57 } |
(...skipping 484 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
539 | 542 |
540 EXPECT_TRUE(task_runner()->GetPendingTasks().empty()); | 543 EXPECT_TRUE(task_runner()->GetPendingTasks().empty()); |
541 EXPECT_EQ(message_center()->add_notification_calls(), 0); | 544 EXPECT_EQ(message_center()->add_notification_calls(), 0); |
542 EXPECT_EQ(message_center()->remove_notification_calls(), 0); | 545 EXPECT_EQ(message_center()->remove_notification_calls(), 0); |
543 EXPECT_EQ(message_center()->notifications_with_shown_as_popup(), 0); | 546 EXPECT_EQ(message_center()->notifications_with_shown_as_popup(), 0); |
544 EXPECT_FALSE(GetBooleanPref(prefs::kWelcomeNotificationDismissed)); | 547 EXPECT_FALSE(GetBooleanPref(prefs::kWelcomeNotificationDismissed)); |
545 EXPECT_TRUE(GetBooleanPref(prefs::kWelcomeNotificationDismissedLocal)); | 548 EXPECT_TRUE(GetBooleanPref(prefs::kWelcomeNotificationDismissedLocal)); |
546 EXPECT_TRUE(GetBooleanPref(prefs::kWelcomeNotificationPreviouslyPoppedUp)); | 549 EXPECT_TRUE(GetBooleanPref(prefs::kWelcomeNotificationPreviouslyPoppedUp)); |
547 EXPECT_EQ(GetInt64Pref(prefs::kWelcomeNotificationExpirationTimestamp), 1); | 550 EXPECT_EQ(GetInt64Pref(prefs::kWelcomeNotificationExpirationTimestamp), 1); |
548 } | 551 } |
OLD | NEW |