| 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 "base/strings/string_number_conversions.h" | 5 #include "base/strings/string_number_conversions.h" |
| 6 #include "base/strings/stringprintf.h" | 6 #include "base/strings/stringprintf.h" |
| 7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
| 8 #include "chrome/browser/browser_process.h" | 8 #include "chrome/browser/browser_process.h" |
| 9 #include "chrome/browser/extensions/api/notifications/notifications_api.h" | 9 #include "chrome/browser/extensions/api/notifications/notifications_api.h" |
| 10 #include "chrome/browser/extensions/extension_apitest.h" | 10 #include "chrome/browser/extensions/extension_apitest.h" |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 ResultCatcher catcher; | 139 ResultCatcher catcher; |
| 140 const std::string notification_id = | 140 const std::string notification_id = |
| 141 GetNotificationIdFromDelegateId(extension->id() + "-BAR"); | 141 GetNotificationIdFromDelegateId(extension->id() + "-BAR"); |
| 142 g_browser_process->message_center()->RemoveNotification(notification_id, | 142 g_browser_process->message_center()->RemoveNotification(notification_id, |
| 143 true); | 143 true); |
| 144 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); | 144 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); |
| 145 } | 145 } |
| 146 | 146 |
| 147 { | 147 { |
| 148 ResultCatcher catcher; | 148 ResultCatcher catcher; |
| 149 g_browser_process->message_center()->RemoveAllNotifications(false); | 149 g_browser_process->message_center()->RemoveAllNotifications( |
| 150 false /* by_user */, message_center::MessageCenter::RemoveType::ALL); |
| 150 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); | 151 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); |
| 151 } | 152 } |
| 152 { | 153 { |
| 153 ResultCatcher catcher; | 154 ResultCatcher catcher; |
| 154 g_browser_process->message_center()->RemoveAllNotifications(true); | 155 g_browser_process->message_center()->RemoveAllNotifications( |
| 156 true /* by_user */, message_center::MessageCenter::RemoveType::ALL); |
| 155 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); | 157 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); |
| 156 } | 158 } |
| 157 } | 159 } |
| 158 | 160 |
| 159 IN_PROC_BROWSER_TEST_F(NotificationsApiTest, TestPartialUpdate) { | 161 IN_PROC_BROWSER_TEST_F(NotificationsApiTest, TestPartialUpdate) { |
| 160 ASSERT_TRUE(RunExtensionTest("notifications/api/partial_update")) << message_; | 162 ASSERT_TRUE(RunExtensionTest("notifications/api/partial_update")) << message_; |
| 161 const extensions::Extension* extension = GetSingleLoadedExtension(); | 163 const extensions::Extension* extension = GetSingleLoadedExtension(); |
| 162 ASSERT_TRUE(extension) << message_; | 164 ASSERT_TRUE(extension) << message_; |
| 163 | 165 |
| 164 const char kNewTitle[] = "Changed!"; | 166 const char kNewTitle[] = "Changed!"; |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 299 ASSERT_TRUE(extension) << message_; | 301 ASSERT_TRUE(extension) << message_; |
| 300 | 302 |
| 301 const message_center::NotificationList::Notifications& notifications = | 303 const message_center::NotificationList::Notifications& notifications = |
| 302 g_browser_process->message_center()->GetVisibleNotifications(); | 304 g_browser_process->message_center()->GetVisibleNotifications(); |
| 303 ASSERT_EQ(1u, notifications.size()); | 305 ASSERT_EQ(1u, notifications.size()); |
| 304 message_center::Notification* notification = *(notifications.begin()); | 306 message_center::Notification* notification = *(notifications.begin()); |
| 305 ASSERT_EQ(extension->url(), notification->origin_url()); | 307 ASSERT_EQ(extension->url(), notification->origin_url()); |
| 306 | 308 |
| 307 EXPECT_TRUE(notification->never_timeout()); | 309 EXPECT_TRUE(notification->never_timeout()); |
| 308 } | 310 } |
| OLD | NEW |