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 | 277 // MessaceCenter-specific test. |
278 #if !defined(OS_WIN) || !defined(USE_ASH) | 278 #if defined(RUN_MESSAGE_CENTER_TESTS) |
| 279 #define MAYBE_TestByUser TestByUser |
| 280 #else |
| 281 #define MAYBE_TestByUser DISABLED_TestByUser |
| 282 #endif |
279 | 283 |
280 IN_PROC_BROWSER_TEST_F(NotificationsApiTest, TestByUser) { | 284 IN_PROC_BROWSER_TEST_F(NotificationsApiTest, MAYBE_TestByUser) { |
281 if (!message_center::IsRichNotificationEnabled()) | 285 ASSERT_TRUE(message_center::IsRichNotificationEnabled()); |
282 return; | |
283 | 286 |
284 const extensions::Extension* extension = | 287 const extensions::Extension* extension = |
285 LoadExtensionAndWait("notifications/api/by_user"); | 288 LoadExtensionAndWait("notifications/api/by_user"); |
286 ASSERT_TRUE(extension) << message_; | 289 ASSERT_TRUE(extension) << message_; |
287 | 290 |
288 { | 291 { |
289 ResultCatcher catcher; | 292 ResultCatcher catcher; |
290 g_browser_process->message_center()->RemoveNotification( | 293 g_browser_process->message_center()->RemoveNotification( |
291 extension->id() + "-FOO", | 294 extension->id() + "-FOO", |
292 false); | 295 false); |
293 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); | 296 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); |
294 } | 297 } |
295 | 298 |
296 { | 299 { |
297 ResultCatcher catcher; | 300 ResultCatcher catcher; |
298 g_browser_process->message_center()->RemoveNotification( | 301 g_browser_process->message_center()->RemoveNotification( |
299 extension->id() + "-BAR", | 302 extension->id() + "-BAR", |
300 true); | 303 true); |
301 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); | 304 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); |
302 } | 305 } |
303 } | 306 } |
304 | |
305 #endif | |
306 #endif | |
OLD | NEW |