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

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: 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) 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 IN_PROC_BROWSER_TEST_F(MessageCenterNotificationsTest, BasicAddCancel) {
106 if (!NotificationUIManager::DelegatesToMessageCenter())
107 return;
107 manager()->Add(CreateTestNotification("hey"), profile()); 108 manager()->Add(CreateTestNotification("hey"), profile());
108 EXPECT_EQ(1u, message_center()->NotificationCount()); 109 EXPECT_EQ(1u, message_center()->NotificationCount());
109 manager()->CancelById("hey"); 110 manager()->CancelById("hey");
110 EXPECT_EQ(0u, message_center()->NotificationCount()); 111 EXPECT_EQ(0u, message_center()->NotificationCount());
111 } 112 }
112 113
113 IN_PROC_BROWSER_TEST_F(MessageCenterNotificationsTest, BasicDelegate) { 114 IN_PROC_BROWSER_TEST_F(MessageCenterNotificationsTest, BasicDelegate) {
115 if (!NotificationUIManager::DelegatesToMessageCenter())
116 return;
114 TestDelegate* delegate; 117 TestDelegate* delegate;
115 manager()->Add(CreateTestNotification("hey", &delegate), profile()); 118 manager()->Add(CreateTestNotification("hey", &delegate), profile());
116 // Verify that delegate accumulated correct log of events. 119 // Verify that delegate accumulated correct log of events.
117 EXPECT_EQ("Display_", delegate->log()); 120 EXPECT_EQ("Display_", delegate->log());
118 manager()->CancelById("hey"); 121 manager()->CancelById("hey");
119 // Verify that delegate accumulated correct log of events. 122 // Verify that delegate accumulated correct log of events.
120 EXPECT_EQ("Display_Close_programmatically_", delegate->log()); 123 EXPECT_EQ("Display_Close_programmatically_", delegate->log());
121 delegate->Release(); 124 delegate->Release();
122 } 125 }
123 126
124 IN_PROC_BROWSER_TEST_F(MessageCenterNotificationsTest, ButtonClickedDelegate) { 127 IN_PROC_BROWSER_TEST_F(MessageCenterNotificationsTest, ButtonClickedDelegate) {
128 if (!NotificationUIManager::DelegatesToMessageCenter())
129 return;
125 TestDelegate* delegate; 130 TestDelegate* delegate;
126 manager()->Add(CreateTestNotification("n", &delegate), profile()); 131 manager()->Add(CreateTestNotification("n", &delegate), profile());
127 message_center()->ClickOnNotificationButton("n", 1); 132 message_center()->ClickOnNotificationButton("n", 1);
128 // Verify that delegate accumulated correct log of events. 133 // Verify that delegate accumulated correct log of events.
129 EXPECT_EQ("Display_ButtonClick_1_", delegate->log()); 134 EXPECT_EQ("Display_ButtonClick_1_", delegate->log());
130 delegate->Release(); 135 delegate->Release();
131 } 136 }
132 137
133 #endif // !defined(OS_MACOSX) 138 #endif // !defined(OS_MACOSX)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698