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 "chrome/browser/browser_process.h" | 5 #include "chrome/browser/browser_process.h" |
6 #include "chrome/browser/extensions/api/notifications/notifications_api.h" | 6 #include "chrome/browser/extensions/api/notifications/notifications_api.h" |
7 #include "chrome/browser/extensions/extension_apitest.h" | 7 #include "chrome/browser/extensions/extension_apitest.h" |
8 #include "chrome/browser/extensions/extension_function_test_utils.h" | 8 #include "chrome/browser/extensions/extension_function_test_utils.h" |
9 #include "chrome/common/chrome_notification_types.h" | 9 #include "chrome/common/chrome_notification_types.h" |
10 #include "chrome/common/chrome_switches.h" | 10 #include "chrome/common/chrome_switches.h" |
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
267 return; | 267 return; |
268 #endif | 268 #endif |
269 | 269 |
270 ASSERT_TRUE(RunExtensionTest("notifications/api/events")) << message_; | 270 ASSERT_TRUE(RunExtensionTest("notifications/api/events")) << message_; |
271 } | 271 } |
272 | 272 |
273 IN_PROC_BROWSER_TEST_F(NotificationsApiTest, TestCSP) { | 273 IN_PROC_BROWSER_TEST_F(NotificationsApiTest, TestCSP) { |
274 ASSERT_TRUE(RunExtensionTest("notifications/api/csp")) << message_; | 274 ASSERT_TRUE(RunExtensionTest("notifications/api/csp")) << message_; |
275 } | 275 } |
276 | 276 |
277 #ifdef ENABLE_MESSAGE_CENTER | |
278 #if !defined(OS_WIN) || !defined(USE_ASH) | 277 #if !defined(OS_WIN) || !defined(USE_ASH) |
279 | 278 |
280 IN_PROC_BROWSER_TEST_F(NotificationsApiTest, TestByUser) { | 279 IN_PROC_BROWSER_TEST_F(NotificationsApiTest, TestByUser) { |
281 if (!message_center::IsRichNotificationEnabled()) | 280 SKIP_THIS_TEST_IF_MESSAGE_CENTER_DISABLED(); |
282 return; | |
283 | 281 |
284 const extensions::Extension* extension = | 282 const extensions::Extension* extension = |
285 LoadExtensionAndWait("notifications/api/by_user"); | 283 LoadExtensionAndWait("notifications/api/by_user"); |
286 ASSERT_TRUE(extension) << message_; | 284 ASSERT_TRUE(extension) << message_; |
287 | 285 |
288 { | 286 { |
289 ResultCatcher catcher; | 287 ResultCatcher catcher; |
290 g_browser_process->message_center()->RemoveNotification( | 288 g_browser_process->message_center()->RemoveNotification( |
291 extension->id() + "-FOO", | 289 extension->id() + "-FOO", |
292 false); | 290 false); |
293 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); | 291 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); |
294 } | 292 } |
295 | 293 |
296 { | 294 { |
297 ResultCatcher catcher; | 295 ResultCatcher catcher; |
298 g_browser_process->message_center()->RemoveNotification( | 296 g_browser_process->message_center()->RemoveNotification( |
299 extension->id() + "-BAR", | 297 extension->id() + "-BAR", |
300 true); | 298 true); |
301 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); | 299 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); |
302 } | 300 } |
303 } | 301 } |
304 | 302 |
305 #endif | 303 #endif |
306 #endif | |
OLD | NEW |