| 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/system/status_area_widget.h" | 9 #include "ash/system/status_area_widget.h" |
| 10 #include "ash/system/tray/system_tray_item.h" | 10 #include "ash/system/tray/system_tray_item.h" |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 notification_ids_.insert(id); | 50 notification_ids_.insert(id); |
| 51 tray->AddNotification(id, | 51 tray->AddNotification(id, |
| 52 ASCIIToUTF16("Test Web Notification"), | 52 ASCIIToUTF16("Test Web Notification"), |
| 53 ASCIIToUTF16("Notification message body."), | 53 ASCIIToUTF16("Notification message body."), |
| 54 ASCIIToUTF16("www.test.org"), | 54 ASCIIToUTF16("www.test.org"), |
| 55 "" /* extension id */); | 55 "" /* extension id */); |
| 56 } | 56 } |
| 57 | 57 |
| 58 void RemoveNotification(WebNotificationTray* tray, const std::string& id) { | 58 void RemoveNotification(WebNotificationTray* tray, const std::string& id) { |
| 59 tray->RemoveNotification(id); | 59 tray->RemoveNotification(id); |
| 60 notification_ids_.erase(id); |
| 60 } | 61 } |
| 61 | 62 |
| 62 bool HasNotificationId(const std::string& id) { | 63 bool HasNotificationId(const std::string& id) { |
| 63 return notification_ids_.find(id) != notification_ids_.end(); | 64 return notification_ids_.find(id) != notification_ids_.end(); |
| 64 } | 65 } |
| 65 | 66 |
| 66 private: | 67 private: |
| 67 std::set<std::string> notification_ids_; | 68 std::set<std::string> notification_ids_; |
| 68 | 69 |
| 69 DISALLOW_COPY_AND_ASSIGN(TestDelegate); | 70 DISALLOW_COPY_AND_ASSIGN(TestDelegate); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 94 EXPECT_FALSE(delegate->HasNotificationId("test_id2")); | 95 EXPECT_FALSE(delegate->HasNotificationId("test_id2")); |
| 95 EXPECT_EQ(1, tray->GetNotificationCount()); | 96 EXPECT_EQ(1, tray->GetNotificationCount()); |
| 96 | 97 |
| 97 // Removing the last notification should hide the bubble. | 98 // Removing the last notification should hide the bubble. |
| 98 delegate->RemoveNotification(tray, "test_id1"); | 99 delegate->RemoveNotification(tray, "test_id1"); |
| 99 EXPECT_EQ(0, tray->GetNotificationCount()); | 100 EXPECT_EQ(0, tray->GetNotificationCount()); |
| 100 EXPECT_TRUE(tray->notification_bubble() == NULL); | 101 EXPECT_TRUE(tray->notification_bubble() == NULL); |
| 101 } | 102 } |
| 102 | 103 |
| 103 } // namespace ash | 104 } // namespace ash |
| OLD | NEW |