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

Side by Side Diff: chrome/browser/notifications/message_center_notifications_browsertest.cc

Issue 15025002: Remove ENABLE_MESSAGE_CENTER (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fixing static initializer 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) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 <string> 5 #include <string>
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/string_util.h" 8 #include "base/string_util.h"
9 #include "base/strings/string_number_conversions.h" 9 #include "base/strings/string_number_conversions.h"
10 #include "base/utf_string_conversions.h" 10 #include "base/utf_string_conversions.h"
11 #include "chrome/browser/browser_process.h" 11 #include "chrome/browser/browser_process.h"
12 #include "chrome/browser/notifications/message_center_notification_manager.h" 12 #include "chrome/browser/notifications/message_center_notification_manager.h"
13 #include "chrome/browser/notifications/notification.h" 13 #include "chrome/browser/notifications/notification.h"
14 #include "chrome/browser/notifications/notification_ui_manager.h" 14 #include "chrome/browser/notifications/notification_ui_manager.h"
15 #include "chrome/browser/profiles/profile.h" 15 #include "chrome/browser/profiles/profile.h"
16 #include "chrome/browser/ui/browser.h" 16 #include "chrome/browser/ui/browser.h"
17 #include "chrome/test/base/in_process_browser_test.h" 17 #include "chrome/test/base/in_process_browser_test.h"
18 #include "ui/message_center/message_center.h" 18 #include "ui/message_center/message_center.h"
19
20 #if defined(ENABLE_MESSAGE_CENTER)
21 #include "ui/message_center/message_center_switches.h" 19 #include "ui/message_center/message_center_switches.h"
22 #endif 20 #include "ui/message_center/message_center_util.h"
23 21
24 class MessageCenterNotificationsTest : public InProcessBrowserTest { 22 class MessageCenterNotificationsTest : public InProcessBrowserTest {
25 public: 23 public:
26 MessageCenterNotificationsTest() {} 24 MessageCenterNotificationsTest() {}
27 25
28 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { 26 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE {
29 // This switch enables the new piping of Notifications through Message 27 // This switch enables the new piping of Notifications through Message
30 // Center. 28 // Center.
31 command_line->AppendSwitch( 29 command_line->AppendSwitch(
32 message_center::switches::kEnableRichNotifications); 30 message_center::switches::kEnableRichNotifications);
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 new_delegate); 89 new_delegate);
92 } 90 }
93 }; 91 };
94 92
95 // TODO(rsesek): Implement Message Center on Mac and get these tests passing 93 // TODO(rsesek): Implement Message Center on Mac and get these tests passing
96 // for real. http://crbug.com/179904 94 // for real. http://crbug.com/179904
97 #if !defined(OS_MACOSX) 95 #if !defined(OS_MACOSX)
98 96
99 IN_PROC_BROWSER_TEST_F(MessageCenterNotificationsTest, RetrieveBaseParts) { 97 IN_PROC_BROWSER_TEST_F(MessageCenterNotificationsTest, RetrieveBaseParts) {
100 // Make sure comamnd-line switch has an effect. 98 // Make sure comamnd-line switch has an effect.
101 EXPECT_TRUE(NotificationUIManager::DelegatesToMessageCenter()); 99 EXPECT_EQ(NotificationUIManager::DelegatesToMessageCenter(),
100 message_center::IsRichNotificationEnabled());
102 EXPECT_TRUE(manager()); 101 EXPECT_TRUE(manager());
103 EXPECT_TRUE(message_center()); 102 EXPECT_TRUE(message_center());
104 } 103 }
105 104
106 IN_PROC_BROWSER_TEST_F(MessageCenterNotificationsTest, BasicAddCancel) { 105 // MessaceCenter-specific test.
106 #if defined(RUN_MESSAGE_CENTER_TESTS)
107 #define MAYBE_BasicAddCancel BasicAddCancel
108 #else
109 #define MAYBE_BasicAddCancel DISABLED_BasicAddCancel
110 #endif
111
112 IN_PROC_BROWSER_TEST_F(MessageCenterNotificationsTest, MAYBE_BasicAddCancel) {
113 EXPECT_TRUE(NotificationUIManager::DelegatesToMessageCenter());
107 manager()->Add(CreateTestNotification("hey"), profile()); 114 manager()->Add(CreateTestNotification("hey"), profile());
108 EXPECT_EQ(1u, message_center()->NotificationCount()); 115 EXPECT_EQ(1u, message_center()->NotificationCount());
109 manager()->CancelById("hey"); 116 manager()->CancelById("hey");
110 EXPECT_EQ(0u, message_center()->NotificationCount()); 117 EXPECT_EQ(0u, message_center()->NotificationCount());
111 } 118 }
112 119
113 IN_PROC_BROWSER_TEST_F(MessageCenterNotificationsTest, BasicDelegate) { 120 // MessaceCenter-specific test.
121 #if defined(RUN_MESSAGE_CENTER_TESTS)
122 #define MAYBE_BasicDelegate BasicDelegate
123 #else
124 #define MAYBE_BasicDelegate DISABLED_BasicDelegate
125 #endif
126
127 IN_PROC_BROWSER_TEST_F(MessageCenterNotificationsTest, MAYBE_BasicDelegate) {
128 EXPECT_TRUE(NotificationUIManager::DelegatesToMessageCenter());
114 TestDelegate* delegate; 129 TestDelegate* delegate;
115 manager()->Add(CreateTestNotification("hey", &delegate), profile()); 130 manager()->Add(CreateTestNotification("hey", &delegate), profile());
116 // Verify that delegate accumulated correct log of events. 131 // Verify that delegate accumulated correct log of events.
117 EXPECT_EQ("Display_", delegate->log()); 132 EXPECT_EQ("Display_", delegate->log());
118 manager()->CancelById("hey"); 133 manager()->CancelById("hey");
119 // Verify that delegate accumulated correct log of events. 134 // Verify that delegate accumulated correct log of events.
120 EXPECT_EQ("Display_Close_programmatically_", delegate->log()); 135 EXPECT_EQ("Display_Close_programmatically_", delegate->log());
121 delegate->Release(); 136 delegate->Release();
122 } 137 }
123 138
124 IN_PROC_BROWSER_TEST_F(MessageCenterNotificationsTest, ButtonClickedDelegate) { 139 // MessaceCenter-specific test.
140 #if defined(RUN_MESSAGE_CENTER_TESTS)
141 #define MAYBE_ButtonClickedDelegate ButtonClickedDelegate
142 #else
143 #define MAYBE_ButtonClickedDelegate DISABLED_ButtonClickedDelegate
144 #endif
145
146 IN_PROC_BROWSER_TEST_F(MessageCenterNotificationsTest,
147 MAYBE_ButtonClickedDelegate) {
148 EXPECT_TRUE(NotificationUIManager::DelegatesToMessageCenter());
125 TestDelegate* delegate; 149 TestDelegate* delegate;
126 manager()->Add(CreateTestNotification("n", &delegate), profile()); 150 manager()->Add(CreateTestNotification("n", &delegate), profile());
127 message_center()->ClickOnNotificationButton("n", 1); 151 message_center()->ClickOnNotificationButton("n", 1);
128 // Verify that delegate accumulated correct log of events. 152 // Verify that delegate accumulated correct log of events.
129 EXPECT_EQ("Display_ButtonClick_1_", delegate->log()); 153 EXPECT_EQ("Display_ButtonClick_1_", delegate->log());
130 delegate->Release(); 154 delegate->Release();
131 } 155 }
132 156
133 #endif // !defined(OS_MACOSX) 157 #endif // !defined(OS_MACOSX)
OLDNEW
« no previous file with comments | « chrome/browser/notifications/desktop_notifications_unittest.cc ('k') | chrome/browser/notifications/notification.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698