OLD | NEW |
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_number_conversions.h" | 8 #include "base/string_number_conversions.h" |
9 #include "base/string_util.h" | 9 #include "base/string_util.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/common/chrome_switches.h" | |
18 #include "chrome/test/base/in_process_browser_test.h" | 17 #include "chrome/test/base/in_process_browser_test.h" |
19 #include "ui/message_center/message_center.h" | 18 #include "ui/message_center/message_center.h" |
20 | 19 |
| 20 #if defined(ENABLE_MESSAGE_CENTER) |
| 21 #include "ui/message_center/message_center_switches.h" |
| 22 #endif |
| 23 |
21 class MessageCenterNotificationsTest : public InProcessBrowserTest { | 24 class MessageCenterNotificationsTest : public InProcessBrowserTest { |
22 public: | 25 public: |
23 MessageCenterNotificationsTest() {} | 26 MessageCenterNotificationsTest() {} |
24 | 27 |
25 virtual void SetUpCommandLine(CommandLine* command_line) { | 28 virtual void SetUpCommandLine(CommandLine* command_line) { |
26 // This switch enables the new piping of Notifications through Message | 29 // This switch enables the new piping of Notifications through Message |
27 // Center. | 30 // Center. |
28 command_line->AppendSwitch(switches::kEnableRichNotifications); | 31 #if defined(ENABLE_MESSAGE_CENTER) |
| 32 command_line->AppendSwitch( |
| 33 message_center::switches::kEnableRichNotifications); |
| 34 #endif |
29 } | 35 } |
30 | 36 |
31 MessageCenterNotificationManager* manager() { | 37 MessageCenterNotificationManager* manager() { |
32 return static_cast<MessageCenterNotificationManager*>( | 38 return static_cast<MessageCenterNotificationManager*>( |
33 g_browser_process->notification_ui_manager()); | 39 g_browser_process->notification_ui_manager()); |
34 } | 40 } |
35 | 41 |
36 message_center::MessageCenter* message_center() { | 42 message_center::MessageCenter* message_center() { |
37 return g_browser_process->message_center(); | 43 return g_browser_process->message_center(); |
38 } | 44 } |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 | 119 |
114 IN_PROC_BROWSER_TEST_F(MessageCenterNotificationsTest, ButtonClickedDelegate) { | 120 IN_PROC_BROWSER_TEST_F(MessageCenterNotificationsTest, ButtonClickedDelegate) { |
115 TestDelegate* delegate; | 121 TestDelegate* delegate; |
116 manager()->Add(CreateTestNotification("n", &delegate), profile()); | 122 manager()->Add(CreateTestNotification("n", &delegate), profile()); |
117 message_center()->OnButtonClicked("n", 1); | 123 message_center()->OnButtonClicked("n", 1); |
118 // Verify that delegate accumulated correct log of events. | 124 // Verify that delegate accumulated correct log of events. |
119 EXPECT_EQ("Display_ButtonClick_1_", delegate->log()); | 125 EXPECT_EQ("Display_ButtonClick_1_", delegate->log()); |
120 delegate->Release(); | 126 delegate->Release(); |
121 } | 127 } |
122 | 128 |
OLD | NEW |