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 "ash/system/web_notification/web_notification_tray.h" | 5 #include "ash/system/web_notification/web_notification_tray.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "ash/display/display_manager.h" | 9 #include "ash/display/display_manager.h" |
10 #include "ash/root_window_controller.h" | 10 #include "ash/root_window_controller.h" |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 | 94 |
95 void TearDown() override { | 95 void TearDown() override { |
96 GetMessageCenter()->RemoveAllNotifications(false); | 96 GetMessageCenter()->RemoveAllNotifications(false); |
97 test::AshTestBase::TearDown(); | 97 test::AshTestBase::TearDown(); |
98 } | 98 } |
99 | 99 |
100 protected: | 100 protected: |
101 void AddNotification(const std::string& id) { | 101 void AddNotification(const std::string& id) { |
102 scoped_ptr<message_center::Notification> notification; | 102 scoped_ptr<message_center::Notification> notification; |
103 notification.reset(new message_center::Notification( | 103 notification.reset(new message_center::Notification( |
104 message_center::NOTIFICATION_TYPE_SIMPLE, | 104 message_center::NOTIFICATION_TYPE_SIMPLE, id, |
105 id, | |
106 base::ASCIIToUTF16("Test Web Notification"), | 105 base::ASCIIToUTF16("Test Web Notification"), |
107 base::ASCIIToUTF16("Notification message body."), | 106 base::ASCIIToUTF16("Notification message body."), gfx::Image(), |
108 gfx::Image(), | 107 base::ASCIIToUTF16("www.test.org"), GURL(), |
109 base::ASCIIToUTF16("www.test.org"), | 108 message_center::NotifierId(), message_center::RichNotificationData(), |
110 message_center::NotifierId(), | |
111 message_center::RichNotificationData(), | |
112 NULL /* delegate */)); | 109 NULL /* delegate */)); |
113 GetMessageCenter()->AddNotification(notification.Pass()); | 110 GetMessageCenter()->AddNotification(notification.Pass()); |
114 } | 111 } |
115 | 112 |
116 void UpdateNotification(const std::string& old_id, | 113 void UpdateNotification(const std::string& old_id, |
117 const std::string& new_id) { | 114 const std::string& new_id) { |
118 scoped_ptr<message_center::Notification> notification; | 115 scoped_ptr<message_center::Notification> notification; |
119 notification.reset(new message_center::Notification( | 116 notification.reset(new message_center::Notification( |
120 message_center::NOTIFICATION_TYPE_SIMPLE, | 117 message_center::NOTIFICATION_TYPE_SIMPLE, new_id, |
121 new_id, | |
122 base::ASCIIToUTF16("Updated Web Notification"), | 118 base::ASCIIToUTF16("Updated Web Notification"), |
123 base::ASCIIToUTF16("Updated message body."), | 119 base::ASCIIToUTF16("Updated message body."), gfx::Image(), |
124 gfx::Image(), | 120 base::ASCIIToUTF16("www.test.org"), GURL(), |
125 base::ASCIIToUTF16("www.test.org"), | 121 message_center::NotifierId(), message_center::RichNotificationData(), |
126 message_center::NotifierId(), | |
127 message_center::RichNotificationData(), | |
128 NULL /* delegate */)); | 122 NULL /* delegate */)); |
129 GetMessageCenter()->UpdateNotification(old_id, notification.Pass()); | 123 GetMessageCenter()->UpdateNotification(old_id, notification.Pass()); |
130 } | 124 } |
131 | 125 |
132 void RemoveNotification(const std::string& id) { | 126 void RemoveNotification(const std::string& id) { |
133 GetMessageCenter()->RemoveNotification(id, false); | 127 GetMessageCenter()->RemoveNotification(id, false); |
134 } | 128 } |
135 | 129 |
136 views::Widget* GetWidget() { | 130 views::Widget* GetWidget() { |
137 return GetTray()->GetWidget(); | 131 return GetTray()->GetWidget(); |
(...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
527 ui::TouchEvent release(ui::ET_TOUCH_RELEASED, out_of_bounds, touch_id, | 521 ui::TouchEvent release(ui::ET_TOUCH_RELEASED, out_of_bounds, touch_id, |
528 move.time_stamp()+base::TimeDelta::FromMilliseconds(50)); | 522 move.time_stamp()+base::TimeDelta::FromMilliseconds(50)); |
529 generator.Dispatch(&release); | 523 generator.Dispatch(&release); |
530 EXPECT_FALSE(tray->draw_background_as_active()); | 524 EXPECT_FALSE(tray->draw_background_as_active()); |
531 EXPECT_FALSE(tray->IsMessageCenterBubbleVisible()); | 525 EXPECT_FALSE(tray->IsMessageCenterBubbleVisible()); |
532 } | 526 } |
533 | 527 |
534 #endif // OS_CHROMEOS | 528 #endif // OS_CHROMEOS |
535 | 529 |
536 } // namespace ash | 530 } // namespace ash |
OLD | NEW |