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