OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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 "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/run_loop.h" | 7 #include "base/run_loop.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_prefs_manager.h" | 12 #include "chrome/browser/notifications/notification_prefs_manager.h" |
13 #include "chrome/browser/notifications/notification_test_util.h" | 13 #include "chrome/browser/notifications/notification_test_util.h" |
14 #include "chrome/common/pref_names.h" | 14 #include "chrome/common/pref_names.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 "content/public/test/test_browser_thread_bundle.h" | 18 #include "content/public/test/test_browser_thread_bundle.h" |
19 #include "testing/gtest/include/gtest/gtest.h" | 19 #include "testing/gtest/include/gtest/gtest.h" |
20 #include "ui/message_center/fake_notifier_settings_provider.h" | 20 #include "ui/message_center/fake_notifier_settings_provider.h" |
21 #include "ui/message_center/message_center_impl.h" | 21 #include "ui/message_center/message_center_impl.h" |
22 #include "ui/message_center/message_center_tray.h" | 22 #include "ui/message_center/message_center_tray.h" |
23 #include "ui/message_center/message_center_tray_delegate.h" | 23 #include "ui/message_center/message_center_tray_delegate.h" |
| 24 #include "ui/message_center/message_center_types.h" |
24 #include "ui/message_center/notifier_settings.h" | 25 #include "ui/message_center/notifier_settings.h" |
25 | 26 |
26 namespace message_center { | 27 namespace message_center { |
27 class FakeMessageCenterTrayDelegate : public MessageCenterTrayDelegate { | 28 class FakeMessageCenterTrayDelegate : public MessageCenterTrayDelegate { |
28 public: | 29 public: |
29 FakeMessageCenterTrayDelegate(MessageCenter* message_center, | 30 FakeMessageCenterTrayDelegate(MessageCenter* message_center, |
30 base::Closure quit_closure) | 31 base::Closure quit_closure) |
31 : tray_(this, message_center), | 32 : tray_(this, message_center), |
32 quit_closure_(quit_closure), | 33 quit_closure_(quit_closure), |
33 displayed_first_run_balloon_(false) {} | 34 displayed_first_run_balloon_(false) {} |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 run_loop()->RunUntilIdle(); | 152 run_loop()->RunUntilIdle(); |
152 EXPECT_FALSE(delegate()->displayed_first_run_balloon()); | 153 EXPECT_FALSE(delegate()->displayed_first_run_balloon()); |
153 EXPECT_FALSE(notification_manager()->FirstRunTimerIsActive()); | 154 EXPECT_FALSE(notification_manager()->FirstRunTimerIsActive()); |
154 EXPECT_FALSE(DidFirstRunPref()); | 155 EXPECT_FALSE(DidFirstRunPref()); |
155 } | 156 } |
156 | 157 |
157 TEST_F(MessageCenterNotificationManagerTest, | 158 TEST_F(MessageCenterNotificationManagerTest, |
158 FirstRunNotShownWithMessageCenter) { | 159 FirstRunNotShownWithMessageCenter) { |
159 TestingProfile profile; | 160 TestingProfile profile; |
160 notification_manager()->Add(GetANotification("test"), &profile); | 161 notification_manager()->Add(GetANotification("test"), &profile); |
161 message_center()->SetMessageCenterVisible(true); | 162 message_center()->SetVisibility(message_center::VISIBILITY_MESSAGE_CENTER); |
162 run_loop()->RunUntilIdle(); | 163 run_loop()->RunUntilIdle(); |
163 EXPECT_FALSE(notification_manager()->FirstRunTimerIsActive()); | 164 EXPECT_FALSE(notification_manager()->FirstRunTimerIsActive()); |
164 EXPECT_FALSE(DidFirstRunPref()); | 165 EXPECT_FALSE(DidFirstRunPref()); |
165 } | 166 } |
166 } // namespace message_center | 167 } // namespace message_center |
OLD | NEW |