| 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/extensions/extension_apitest.h" | 5 #include "chrome/browser/extensions/extension_apitest.h" |
| 6 | 6 |
| 7 #include "chrome/browser/notifications/desktop_notification_service.h" | 7 #include "chrome/browser/notifications/desktop_notification_service.h" |
| 8 #include "chrome/browser/notifications/desktop_notification_service_factory.h" | 8 #include "chrome/browser/notifications/desktop_notification_service_factory.h" |
| 9 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
| 10 #include "chrome/browser/ui/browser.h" | 10 #include "chrome/browser/ui/browser.h" |
| 11 | 11 |
| 12 // TODO(kbr): remove: http://crbug.com/222296 |
| 13 #if defined(OS_MACOSX) |
| 14 #import "base/mac/mac_util.h" |
| 15 #endif |
| 16 |
| 12 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, NotificationsNoPermission) { | 17 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, NotificationsNoPermission) { |
| 13 #if defined(OS_LINUX) && defined(TOOLKIT_VIEWS) | 18 #if defined(OS_LINUX) && defined(TOOLKIT_VIEWS) |
| 14 // Notifications not supported on linux/views yet. | 19 // Notifications not supported on linux/views yet. |
| 15 #else | 20 #else |
| 16 ASSERT_TRUE(RunExtensionTest("notifications/has_not_permission")) << message_; | 21 ASSERT_TRUE(RunExtensionTest("notifications/has_not_permission")) << message_; |
| 17 #endif | 22 #endif |
| 18 } | 23 } |
| 19 | 24 |
| 20 // Disabled after createHTMLNotification removal | 25 // Disabled after createHTMLNotification removal |
| 21 // (http://trac.webkit.org/changeset/140983) | 26 // (http://trac.webkit.org/changeset/140983) |
| 22 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, | 27 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, |
| 23 DISABLED_NotificationsHasPermissionManifest) { | 28 DISABLED_NotificationsHasPermissionManifest) { |
| 24 #if defined(OS_LINUX) && defined(TOOLKIT_VIEWS) | 29 #if defined(OS_LINUX) && defined(TOOLKIT_VIEWS) |
| 25 // Notifications not supported on linux/views yet. | 30 // Notifications not supported on linux/views yet. |
| 26 #else | 31 #else |
| 27 ASSERT_TRUE(RunExtensionTest("notifications/has_permission_manifest")) | 32 ASSERT_TRUE(RunExtensionTest("notifications/has_permission_manifest")) |
| 28 << message_; | 33 << message_; |
| 29 #endif | 34 #endif |
| 30 } | 35 } |
| 31 | 36 |
| 32 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, NotificationsHasPermission) { | 37 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, NotificationsHasPermission) { |
| 33 #if defined(OS_LINUX) && defined(TOOLKIT_VIEWS) | 38 #if defined(OS_LINUX) && defined(TOOLKIT_VIEWS) |
| 34 // Notifications not supported on linux/views yet. | 39 // Notifications not supported on linux/views yet. |
| 35 #else | 40 #else |
| 41 |
| 42 #if defined(OS_MACOSX) |
| 43 // TODO(kbr): re-enable: http://crbug.com/222296 |
| 44 if (base::mac::IsOSMountainLionOrLater()) |
| 45 return; |
| 46 #endif |
| 47 |
| 36 DesktopNotificationServiceFactory::GetForProfile(browser()->profile()) | 48 DesktopNotificationServiceFactory::GetForProfile(browser()->profile()) |
| 37 ->GrantPermission(GURL( | 49 ->GrantPermission(GURL( |
| 38 "chrome-extension://peoadpeiejnhkmpaakpnompolbglelel")); | 50 "chrome-extension://peoadpeiejnhkmpaakpnompolbglelel")); |
| 39 ASSERT_TRUE(RunExtensionTest("notifications/has_permission_prefs")) | 51 ASSERT_TRUE(RunExtensionTest("notifications/has_permission_prefs")) |
| 40 << message_; | 52 << message_; |
| 41 #endif | 53 #endif |
| 42 } | 54 } |
| OLD | NEW |