summaryrefslogtreecommitdiffstats
path: root/chrome/browser/extensions/notifications_apitest.cc
diff options
context:
space:
mode:
authordewittj@chromium.org <dewittj@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-04-09 04:37:19 +0000
committerdewittj@chromium.org <dewittj@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-04-09 04:37:19 +0000
commit16dc4245870d40d56dbcfbc05ad2c0cc1a1001e0 (patch)
tree676d50c8660a4bad1499e42c100b0f39dfaff8b4 /chrome/browser/extensions/notifications_apitest.cc
parent00b40f73f712de09075f60760de2a28c650445ff (diff)
downloadchromium_src-16dc4245870d40d56dbcfbc05ad2c0cc1a1001e0.zip
chromium_src-16dc4245870d40d56dbcfbc05ad2c0cc1a1001e0.tar.gz
chromium_src-16dc4245870d40d56dbcfbc05ad2c0cc1a1001e0.tar.bz2
Disables HTML notifications when rich notifications are enabled.
This works by adding a new flag to the content layer: kDisableHTMLNotifications, which causes Chrome not to expose the webkitNotifications.createHTMLNotification function to JS contexts. Chrome appends this switch to new renderer processes when appropriate in ChromeContentBrowserClient. BUG=225918 Review URL: https://chromiumcodereview.appspot.com/13533019 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@193005 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/extensions/notifications_apitest.cc')
-rw-r--r--chrome/browser/extensions/notifications_apitest.cc52
1 files changed, 45 insertions, 7 deletions
diff --git a/chrome/browser/extensions/notifications_apitest.cc b/chrome/browser/extensions/notifications_apitest.cc
index 834efa4..261275c 100644
--- a/chrome/browser/extensions/notifications_apitest.cc
+++ b/chrome/browser/extensions/notifications_apitest.cc
@@ -9,6 +9,31 @@
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/browser.h"
+#if defined(ENABLE_MESSAGE_CENTER)
+
+#include "ui/message_center/message_center_switches.h"
+#include "ui/message_center/message_center_util.h"
+
+class RichWebkitNotificationTest : public ExtensionApiTest {
+ protected:
+ virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE {
+ ExtensionApiTest::SetUpCommandLine(command_line);
+ command_line->AppendSwitch(
+ message_center::switches::kEnableRichNotifications);
+ }
+};
+
+class DisabledRichWebkitNotificationTest : public ExtensionApiTest {
+ protected:
+ virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE {
+ ExtensionApiTest::SetUpCommandLine(command_line);
+ command_line->AppendSwitch(
+ message_center::switches::kDisableRichNotifications);
+ }
+};
+
+#endif
+
// TODO(kbr): remove: http://crbug.com/222296
#if defined(OS_MACOSX)
#import "base/mac/mac_util.h"
@@ -22,17 +47,30 @@ IN_PROC_BROWSER_TEST_F(ExtensionApiTest, NotificationsNoPermission) {
#endif
}
-// Disabled after createHTMLNotification removal
-// (http://trac.webkit.org/changeset/140983)
-IN_PROC_BROWSER_TEST_F(ExtensionApiTest,
- DISABLED_NotificationsHasPermissionManifest) {
-#if defined(OS_LINUX) && defined(TOOLKIT_VIEWS)
- // Notifications not supported on linux/views yet.
-#else
+#if defined(ENABLE_MESSAGE_CENTER)
+IN_PROC_BROWSER_TEST_F(RichWebkitNotificationTest, NoHTMLNotifications) {
+ ASSERT_TRUE(RunExtensionTest("notifications/no_html")) << message_;
+}
+
+#if !defined(OS_CHROMEOS)
+// HTML notifications fail on ChromeOS whether or not rich notifications
+// are enabled.
+IN_PROC_BROWSER_TEST_F(DisabledRichWebkitNotificationTest,
+ HasHTMLNotifications) {
+ ASSERT_FALSE(message_center::IsRichNotificationEnabled());
ASSERT_TRUE(RunExtensionTest("notifications/has_permission_manifest"))
<< message_;
+}
#endif
+
+#elif !defined(OS_LINUX) || !defined(TOOLKIT_VIEWS)
+// Notifications not supported on linux/views yet.
+IN_PROC_BROWSER_TEST_F(ExtensionApiTest,
+ NotificationsHasPermissionManifest) {
+ ASSERT_TRUE(RunExtensionTest("notifications/has_permission_manifest"))
+ << message_;
}
+#endif
IN_PROC_BROWSER_TEST_F(ExtensionApiTest, NotificationsHasPermission) {
#if defined(OS_LINUX) && defined(TOOLKIT_VIEWS)