| 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 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 282 notification->ButtonClick(0); | 284 notification->ButtonClick(0); |
| 283 EXPECT_TRUE(catcher.GetNextResult()); | 285 EXPECT_TRUE(catcher.GetNextResult()); |
| 284 notification->Click(); | 286 notification->Click(); |
| 285 EXPECT_TRUE(catcher.GetNextResult()); | 287 EXPECT_TRUE(catcher.GetNextResult()); |
| 286 notification->Close(true); | 288 notification->Close(true); |
| 287 EXPECT_TRUE(catcher.GetNextResult()); | 289 EXPECT_TRUE(catcher.GetNextResult()); |
| 288 notification->Close(false); | 290 notification->Close(false); |
| 289 EXPECT_FALSE(catcher.GetNextResult()); | 291 EXPECT_FALSE(catcher.GetNextResult()); |
| 290 } | 292 } |
| 291 } | 293 } |
| OLD | NEW |