OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "base/memory/scoped_ptr.h" | 5 #include "base/memory/scoped_ptr.h" |
6 #include "base/prefs/testing_pref_service.h" | 6 #include "base/prefs/testing_pref_service.h" |
7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
8 #include "base/test/test_timeouts.h" | 8 #include "base/test/test_timeouts.h" |
9 #include "base/values.h" | 9 #include "base/values.h" |
10 #include "chrome/browser/notifications/message_center_notification_manager.h" | 10 #include "chrome/browser/notifications/message_center_notification_manager.h" |
11 #include "chrome/browser/notifications/notification.h" | 11 #include "chrome/browser/notifications/notification.h" |
12 #include "chrome/browser/notifications/notification_test_util.h" | 12 #include "chrome/browser/notifications/notification_test_util.h" |
13 #include "chrome/common/pref_names.h" | 13 #include "chrome/common/pref_names.h" |
14 #include "chrome/test/base/browser_with_test_window_test.h" | 14 #include "chrome/test/base/browser_with_test_window_test.h" |
15 #include "chrome/test/base/scoped_testing_local_state.h" | 15 #include "chrome/test/base/scoped_testing_local_state.h" |
16 #include "chrome/test/base/testing_browser_process.h" | 16 #include "chrome/test/base/testing_browser_process.h" |
17 #include "chrome/test/base/testing_profile.h" | 17 #include "chrome/test/base/testing_profile.h" |
18 #include "chrome/test/base/testing_profile_manager.h" | 18 #include "chrome/test/base/testing_profile_manager.h" |
19 #include "content/public/test/test_browser_thread_bundle.h" | 19 #include "content/public/test/test_browser_thread_bundle.h" |
20 #include "testing/gtest/include/gtest/gtest.h" | 20 #include "testing/gtest/include/gtest/gtest.h" |
21 #include "ui/message_center/fake_message_center_tray_delegate.h" | 21 #include "ui/message_center/fake_message_center_tray_delegate.h" |
22 #include "ui/message_center/message_center_impl.h" | 22 #include "ui/message_center/message_center_impl.h" |
23 #include "ui/message_center/message_center_tray.h" | 23 #include "ui/message_center/message_center_tray.h" |
24 #include "ui/message_center/message_center_types.h" | 24 #include "ui/message_center/message_center_types.h" |
| 25 #include "ui/message_center/notification_types.h" |
25 #include "ui/message_center/notifier_settings.h" | 26 #include "ui/message_center/notifier_settings.h" |
26 | 27 |
27 #if defined(OS_CHROMEOS) | 28 #if defined(OS_CHROMEOS) |
28 #include "chrome/browser/ui/ash/multi_user/multi_user_notification_blocker_chrom
eos.h" | 29 #include "chrome/browser/ui/ash/multi_user/multi_user_notification_blocker_chrom
eos.h" |
29 #include "chrome/browser/ui/ash/multi_user/multi_user_util.h" | 30 #include "chrome/browser/ui/ash/multi_user/multi_user_util.h" |
30 #include "chrome/browser/ui/ash/multi_user/multi_user_window_manager.h" | 31 #include "chrome/browser/ui/ash/multi_user/multi_user_window_manager.h" |
31 #include "chrome/browser/ui/ash/multi_user/multi_user_window_manager_chromeos.h" | 32 #include "chrome/browser/ui/ash/multi_user/multi_user_window_manager_chromeos.h" |
32 #endif | 33 #endif |
33 | 34 |
34 namespace message_center { | 35 namespace message_center { |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 | 71 |
71 MessageCenterNotificationManager* notification_manager() { | 72 MessageCenterNotificationManager* notification_manager() { |
72 return (MessageCenterNotificationManager*) | 73 return (MessageCenterNotificationManager*) |
73 g_browser_process->notification_ui_manager(); | 74 g_browser_process->notification_ui_manager(); |
74 } | 75 } |
75 | 76 |
76 MessageCenter* message_center() { return message_center_; } | 77 MessageCenter* message_center() { return message_center_; } |
77 | 78 |
78 const ::Notification GetANotification(const std::string& id) { | 79 const ::Notification GetANotification(const std::string& id) { |
79 return ::Notification( | 80 return ::Notification( |
80 GURL("chrome-extension://adflkjsdflkdsfdsflkjdsflkdjfs"), | 81 message_center::NOTIFICATION_TYPE_SIMPLE, |
81 base::string16(), | 82 base::string16(), |
82 base::string16(), | 83 base::string16(), |
83 gfx::Image(), | 84 gfx::Image(), |
| 85 NotifierId(NotifierId::APPLICATION, "adflkjsdflkdsfdsflkjdsflkdjfs"), |
84 base::string16(), | 86 base::string16(), |
| 87 GURL("chrome-extension://adflkjsdflkdsfdsflkjdsflkdjfs"), |
85 id, | 88 id, |
| 89 message_center::RichNotificationData(), |
86 new MockNotificationDelegate(id)); | 90 new MockNotificationDelegate(id)); |
87 } | 91 } |
88 | 92 |
89 private: | 93 private: |
90 scoped_ptr<TestingProfileManager> profile_manager_; | 94 scoped_ptr<TestingProfileManager> profile_manager_; |
91 MessageCenter* message_center_; | 95 MessageCenter* message_center_; |
92 FakeMessageCenterTrayDelegate* delegate_; | 96 FakeMessageCenterTrayDelegate* delegate_; |
93 }; | 97 }; |
94 | 98 |
95 TEST_F(MessageCenterNotificationManagerTest, SetupNotificationManager) { | 99 TEST_F(MessageCenterNotificationManagerTest, SetupNotificationManager) { |
(...skipping 28 matching lines...) Expand all Loading... |
124 EXPECT_EQ(0u, message_center()->NotificationCount()); | 128 EXPECT_EQ(0u, message_center()->NotificationCount()); |
125 notification_manager()->Add(GetANotification("test"), &profile); | 129 notification_manager()->Add(GetANotification("test"), &profile); |
126 EXPECT_EQ(1u, message_center()->NotificationCount()); | 130 EXPECT_EQ(1u, message_center()->NotificationCount()); |
127 notification_manager()->Update(GetANotification("test"), &profile); | 131 notification_manager()->Update(GetANotification("test"), &profile); |
128 EXPECT_EQ(1u, message_center()->NotificationCount()); | 132 EXPECT_EQ(1u, message_center()->NotificationCount()); |
129 chrome::MultiUserWindowManager::DeleteInstance(); | 133 chrome::MultiUserWindowManager::DeleteInstance(); |
130 } | 134 } |
131 #endif | 135 #endif |
132 | 136 |
133 } // namespace message_center | 137 } // namespace message_center |
OLD | NEW |