Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(78)

Side by Side Diff: chrome/browser/extensions/notifications_apitest.cc

Issue 15025002: Remove ENABLE_MESSAGE_CENTER (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: one moer fix Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 "base/logging.h"
7 #include "chrome/browser/notifications/desktop_notification_service.h" 8 #include "chrome/browser/notifications/desktop_notification_service.h"
8 #include "chrome/browser/notifications/desktop_notification_service_factory.h" 9 #include "chrome/browser/notifications/desktop_notification_service_factory.h"
9 #include "chrome/browser/profiles/profile.h" 10 #include "chrome/browser/profiles/profile.h"
10 #include "chrome/browser/ui/browser.h" 11 #include "chrome/browser/ui/browser.h"
11
12 #if defined(ENABLE_MESSAGE_CENTER)
13
14 #include "chrome/browser/extensions/extension_process_manager.h" 12 #include "chrome/browser/extensions/extension_process_manager.h"
15 #include "chrome/browser/extensions/lazy_background_page_test_util.h" 13 #include "chrome/browser/extensions/lazy_background_page_test_util.h"
16 #include "chrome/common/chrome_switches.h" 14 #include "chrome/common/chrome_switches.h"
17 #include "chrome/common/extensions/extension.h" 15 #include "chrome/common/extensions/extension.h"
18 #include "ui/message_center/message_center_switches.h" 16 #include "ui/message_center/message_center_switches.h"
19 #include "ui/message_center/message_center_util.h" 17 #include "ui/message_center/message_center_util.h"
20 18
21 class RichWebkitNotificationTest : public ExtensionApiTest { 19 class RichWebkitNotificationTest : public ExtensionApiTest {
22 protected: 20 protected:
23 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { 21 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE {
(...skipping 25 matching lines...) Expand all
49 const std::string& test_name) { 47 const std::string& test_name) {
50 LazyBackgroundObserver page_complete; 48 LazyBackgroundObserver page_complete;
51 base::FilePath extdir = test_data_dir_.AppendASCII(test_name); 49 base::FilePath extdir = test_data_dir_.AppendASCII(test_name);
52 const extensions::Extension* extension = LoadExtension(extdir); 50 const extensions::Extension* extension = LoadExtension(extdir);
53 if (extension) 51 if (extension)
54 page_complete.Wait(); 52 page_complete.Wait();
55 return extension; 53 return extension;
56 } 54 }
57 }; 55 };
58 56
59 #endif
60
61 // TODO(kbr): remove: http://crbug.com/222296 57 // TODO(kbr): remove: http://crbug.com/222296
62 #if defined(OS_MACOSX) 58 #if defined(OS_MACOSX)
63 #import "base/mac/mac_util.h" 59 #import "base/mac/mac_util.h"
64 #endif 60 #endif
65 61
66 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, NotificationsNoPermission) { 62 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, NotificationsNoPermission) {
67 #if defined(OS_LINUX) && defined(TOOLKIT_VIEWS) 63 SKIP_THIS_TEST_IF_MESSAGE_CENTER_DISABLED();
sky 2013/05/09 15:50:38 Having this compile switch still results in spinni
Dmitry Titov 2013/05/10 00:16:45 Done.
68 // Notifications not supported on linux/views yet.
69 #else
70 ASSERT_TRUE(RunExtensionTest("notifications/has_not_permission")) << message_; 64 ASSERT_TRUE(RunExtensionTest("notifications/has_not_permission")) << message_;
71 #endif
72 } 65 }
73 66
74 #if defined(ENABLE_MESSAGE_CENTER)
75 IN_PROC_BROWSER_TEST_F(RichWebkitNotificationTest, NoHTMLNotifications) { 67 IN_PROC_BROWSER_TEST_F(RichWebkitNotificationTest, NoHTMLNotifications) {
68 SKIP_THIS_TEST_IF_MESSAGE_CENTER_DISABLED();
76 ASSERT_TRUE(RunExtensionTest("notifications/no_html")) << message_; 69 ASSERT_TRUE(RunExtensionTest("notifications/no_html")) << message_;
77 } 70 }
78 71
79 #if !defined(OS_CHROMEOS) 72 #if !defined(OS_CHROMEOS)
80 // HTML notifications fail on ChromeOS whether or not rich notifications 73 // HTML notifications fail on ChromeOS whether or not rich notifications
81 // are enabled. 74 // are enabled.
82 IN_PROC_BROWSER_TEST_F(DisabledRichWebkitNotificationTest, 75 IN_PROC_BROWSER_TEST_F(DisabledRichWebkitNotificationTest,
83 HasHTMLNotifications) { 76 HasHTMLNotificationsAndManifestPermission) {
84 ASSERT_FALSE(message_center::IsRichNotificationEnabled()); 77 ASSERT_FALSE(message_center::IsRichNotificationEnabled());
85 ASSERT_TRUE(RunExtensionTest("notifications/has_permission_manifest")) 78 ASSERT_TRUE(RunExtensionTest("notifications/has_permission_manifest"))
86 << message_; 79 << message_;
87 } 80 }
88 #endif 81 #endif
89 82
90 #elif !defined(OS_LINUX) || !defined(TOOLKIT_VIEWS)
91 // Notifications not supported on linux/views yet.
92 IN_PROC_BROWSER_TEST_F(ExtensionApiTest,
93 NotificationsHasPermissionManifest) {
94 ASSERT_TRUE(RunExtensionTest("notifications/has_permission_manifest"))
95 << message_;
96 }
97 #endif
98
99 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, NotificationsHasPermission) { 83 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, NotificationsHasPermission) {
100 #if defined(OS_LINUX) && defined(TOOLKIT_VIEWS)
101 // Notifications not supported on linux/views yet.
102 #else
103
104 #if defined(OS_MACOSX) 84 #if defined(OS_MACOSX)
105 // TODO(kbr): re-enable: http://crbug.com/222296 85 // TODO(kbr): re-enable: http://crbug.com/222296
106 if (base::mac::IsOSMountainLionOrLater()) 86 if (base::mac::IsOSMountainLionOrLater())
107 return; 87 return;
108 #endif 88 #endif
109 89
110 DesktopNotificationServiceFactory::GetForProfile(browser()->profile()) 90 DesktopNotificationServiceFactory::GetForProfile(browser()->profile())
111 ->GrantPermission(GURL( 91 ->GrantPermission(GURL(
112 "chrome-extension://peoadpeiejnhkmpaakpnompolbglelel")); 92 "chrome-extension://peoadpeiejnhkmpaakpnompolbglelel"));
113 ASSERT_TRUE(RunExtensionTest("notifications/has_permission_prefs")) 93 ASSERT_TRUE(RunExtensionTest("notifications/has_permission_prefs"))
114 << message_; 94 << message_;
115 #endif
116 } 95 }
117 96
118 #if defined(ENABLE_MESSAGE_CENTER)
119 IN_PROC_BROWSER_TEST_F(NotificationIdleTest, NotificationsAllowUnload) { 97 IN_PROC_BROWSER_TEST_F(NotificationIdleTest, NotificationsAllowUnload) {
98 SKIP_THIS_TEST_IF_MESSAGE_CENTER_DISABLED();
120 const extensions::Extension* extension = 99 const extensions::Extension* extension =
121 LoadExtensionAndWait("notifications/api/unload"); 100 LoadExtensionAndWait("notifications/api/unload");
122 ASSERT_TRUE(extension) << message_; 101 ASSERT_TRUE(extension) << message_;
123 102
124 // Lazy Background Page has been shut down. 103 // Lazy Background Page has been shut down.
125 ExtensionProcessManager* pm = 104 ExtensionProcessManager* pm =
126 extensions::ExtensionSystem::Get(profile())->process_manager(); 105 extensions::ExtensionSystem::Get(profile())->process_manager();
127 EXPECT_FALSE(pm->GetBackgroundHostForExtension(last_loaded_extension_id_)); 106 EXPECT_FALSE(pm->GetBackgroundHostForExtension(last_loaded_extension_id_));
128 } 107 }
129 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698