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 <deque> | 5 #include <deque> |
6 #include <string> | 6 #include <string> |
7 | 7 |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/callback.h" | 9 #include "base/callback.h" |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 message_loop_runner_ = new content::MessageLoopRunner; | 95 message_loop_runner_ = new content::MessageLoopRunner; |
96 message_loop_runner_->Run(); | 96 message_loop_runner_->Run(); |
97 return notification_received_; | 97 return notification_received_; |
98 } | 98 } |
99 | 99 |
100 // overridden from message_center::MessageCenterObserver: | 100 // overridden from message_center::MessageCenterObserver: |
101 virtual void OnNotificationAdded( | 101 virtual void OnNotificationAdded( |
102 const std::string& notification_id) OVERRIDE { | 102 const std::string& notification_id) OVERRIDE { |
103 OnMessageCenterChanged(); | 103 OnMessageCenterChanged(); |
104 } | 104 } |
105 virtual void OnNotificationRemoved( | 105 virtual void OnNotificationRemoved(const std::string& notification_id, |
106 const std::string& notification_id, bool by_user) { | 106 bool by_user) OVERRIDE { |
107 OnMessageCenterChanged(); | 107 OnMessageCenterChanged(); |
108 } | 108 } |
109 virtual void OnNotificationUpdated(const std::string& notification_id) { | 109 virtual void OnNotificationUpdated( |
| 110 const std::string& notification_id) OVERRIDE { |
110 OnMessageCenterChanged(); | 111 OnMessageCenterChanged(); |
111 } | 112 } |
112 | 113 |
113 void OnMessageCenterChanged() { | 114 void OnMessageCenterChanged() { |
114 notification_received_ = true; | 115 notification_received_ = true; |
115 if (message_loop_runner_) | 116 if (message_loop_runner_) |
116 message_loop_runner_->Quit(); | 117 message_loop_runner_->Quit(); |
117 } | 118 } |
118 | 119 |
119 bool notification_received_; | 120 bool notification_received_; |
(...skipping 847 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
967 const std::deque<Balloon*>& balloons = GetActiveBalloons(); | 968 const std::deque<Balloon*>& balloons = GetActiveBalloons(); |
968 ASSERT_EQ(1U, balloons.size()); | 969 ASSERT_EQ(1U, balloons.size()); |
969 Balloon* balloon = balloons[0]; | 970 Balloon* balloon = balloons[0]; |
970 const Notification& notification = balloon->notification(); | 971 const Notification& notification = balloon->notification(); |
971 GURL EXPECTED_ICON_URL = test_server()->GetURL(kExpectedIconUrl); | 972 GURL EXPECTED_ICON_URL = test_server()->GetURL(kExpectedIconUrl); |
972 EXPECT_EQ(EXPECTED_ICON_URL, notification.icon_url()); | 973 EXPECT_EQ(EXPECTED_ICON_URL, notification.icon_url()); |
973 EXPECT_EQ(ASCIIToUTF16("Title2"), notification.title()); | 974 EXPECT_EQ(ASCIIToUTF16("Title2"), notification.title()); |
974 EXPECT_EQ(ASCIIToUTF16("Body2"), notification.body()); | 975 EXPECT_EQ(ASCIIToUTF16("Body2"), notification.body()); |
975 #endif | 976 #endif |
976 } | 977 } |
OLD | NEW |