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