OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/desktop_notifications_unittest.h" | 5 #include "chrome/browser/notifications/desktop_notifications_unittest.h" |
6 | 6 |
7 // static | 7 // static |
8 const int MockBalloonCollection::kMockBalloonSpace = 5; | 8 const int MockBalloonCollection::kMockBalloonSpace = 5; |
9 | 9 |
10 // static | 10 // static |
(...skipping 14 matching lines...) Expand all Loading... |
25 DesktopNotificationsTest::log("notification closed by script\n"); | 25 DesktopNotificationsTest::log("notification closed by script\n"); |
26 } | 26 } |
27 | 27 |
28 void MockBalloonCollection::Add(const Notification& notification, | 28 void MockBalloonCollection::Add(const Notification& notification, |
29 Profile* profile) { | 29 Profile* profile) { |
30 // Swap in the logging proxy for the purpose of logging calls that | 30 // Swap in the logging proxy for the purpose of logging calls that |
31 // would be made into javascript, then pass this down to the | 31 // would be made into javascript, then pass this down to the |
32 // balloon collection. | 32 // balloon collection. |
33 Notification test_notification(notification.origin_url(), | 33 Notification test_notification(notification.origin_url(), |
34 notification.content_url(), | 34 notification.content_url(), |
| 35 notification.display_source(), |
35 log_proxy_.get()); | 36 log_proxy_.get()); |
36 BalloonCollectionImpl::Add(test_notification, profile); | 37 BalloonCollectionImpl::Add(test_notification, profile); |
37 } | 38 } |
38 | 39 |
39 bool MockBalloonCollection::Remove(const Notification& notification) { | 40 bool MockBalloonCollection::Remove(const Notification& notification) { |
40 Notification test_notification(notification.origin_url(), | 41 Notification test_notification(notification.origin_url(), |
41 notification.content_url(), | 42 notification.content_url(), |
| 43 notification.display_source(), |
42 log_proxy_.get()); | 44 log_proxy_.get()); |
43 return BalloonCollectionImpl::Remove(test_notification); | 45 return BalloonCollectionImpl::Remove(test_notification); |
44 } | 46 } |
45 | 47 |
46 Balloon* MockBalloonCollection::MakeBalloon(const Notification& notification, | 48 Balloon* MockBalloonCollection::MakeBalloon(const Notification& notification, |
47 Profile* profile) { | 49 Profile* profile) { |
48 // Start with a normal balloon but mock out the view. | 50 // Start with a normal balloon but mock out the view. |
49 Balloon* balloon = BalloonCollectionImpl::MakeBalloon(notification, profile); | 51 Balloon* balloon = BalloonCollectionImpl::MakeBalloon(notification, profile); |
50 balloon->set_view(new MockBalloonView(balloon)); | 52 balloon->set_view(new MockBalloonView(balloon)); |
51 balloons_.insert(balloon); | 53 balloons_.insert(balloon); |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
241 // Create some toasts and then prematurely delete the notification service, | 243 // Create some toasts and then prematurely delete the notification service, |
242 // just to make sure nothing crashes/leaks. | 244 // just to make sure nothing crashes/leaks. |
243 for (int id = 0; id <= 3; ++id) { | 245 for (int id = 0; id <= 3; ++id) { |
244 EXPECT_TRUE(service_->ShowDesktopNotificationText( | 246 EXPECT_TRUE(service_->ShowDesktopNotificationText( |
245 GURL("http://www.google.com"), | 247 GURL("http://www.google.com"), |
246 GURL("/icon.png"), ASCIIToUTF16("Title"), ASCIIToUTF16("Text"), | 248 GURL("/icon.png"), ASCIIToUTF16("Title"), ASCIIToUTF16("Text"), |
247 0, 0, DesktopNotificationService::PageNotification, id)); | 249 0, 0, DesktopNotificationService::PageNotification, id)); |
248 } | 250 } |
249 service_.reset(NULL); | 251 service_.reset(NULL); |
250 } | 252 } |
OLD | NEW |