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" | |
13 #include "chrome/browser/notifications/notification_test_util.h" | 12 #include "chrome/browser/notifications/notification_test_util.h" |
14 #include "chrome/common/pref_names.h" | 13 #include "chrome/common/pref_names.h" |
15 #include "chrome/test/base/scoped_testing_local_state.h" | 14 #include "chrome/test/base/scoped_testing_local_state.h" |
16 #include "chrome/test/base/testing_browser_process.h" | 15 #include "chrome/test/base/testing_browser_process.h" |
17 #include "chrome/test/base/testing_profile.h" | 16 #include "chrome/test/base/testing_profile.h" |
18 #include "content/public/test/test_browser_thread_bundle.h" | 17 #include "content/public/test/test_browser_thread_bundle.h" |
19 #include "testing/gtest/include/gtest/gtest.h" | 18 #include "testing/gtest/include/gtest/gtest.h" |
20 #include "ui/message_center/fake_message_center_tray_delegate.h" | 19 #include "ui/message_center/fake_message_center_tray_delegate.h" |
21 #include "ui/message_center/fake_notifier_settings_provider.h" | 20 #include "ui/message_center/fake_notifier_settings_provider.h" |
22 #include "ui/message_center/message_center_impl.h" | 21 #include "ui/message_center/message_center_impl.h" |
23 #include "ui/message_center/message_center_tray.h" | 22 #include "ui/message_center/message_center_tray.h" |
24 #include "ui/message_center/message_center_types.h" | 23 #include "ui/message_center/message_center_types.h" |
25 #include "ui/message_center/notifier_settings.h" | 24 #include "ui/message_center/notifier_settings.h" |
26 | 25 |
27 namespace message_center { | 26 namespace message_center { |
28 | 27 |
29 class MessageCenterNotificationManagerTest : public testing::Test { | 28 class MessageCenterNotificationManagerTest : public testing::Test { |
30 protected: | 29 protected: |
31 MessageCenterNotificationManagerTest() { | 30 MessageCenterNotificationManagerTest() {} |
32 NotificationPrefsManager::RegisterPrefs(local_state_.registry()); | |
33 } | |
34 | 31 |
35 virtual void SetUp() { | 32 virtual void SetUp() { |
36 // Clear the preference and initialize. | 33 // Clear the preference and initialize. |
37 local_state_.ClearPref(prefs::kMessageCenterShowedFirstRunBalloon); | 34 local_state_.ClearPref(prefs::kMessageCenterShowedFirstRunBalloon); |
38 first_run_pref_.Init(prefs::kMessageCenterShowedFirstRunBalloon, | 35 first_run_pref_.Init(prefs::kMessageCenterShowedFirstRunBalloon, |
39 &local_state_); | 36 &local_state_); |
40 | 37 |
41 // Get ourselves a run loop. | 38 // Get ourselves a run loop. |
42 run_loop_.reset(new base::RunLoop()); | 39 run_loop_.reset(new base::RunLoop()); |
43 | 40 |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 TEST_F(MessageCenterNotificationManagerTest, | 124 TEST_F(MessageCenterNotificationManagerTest, |
128 FirstRunNotShownWithMessageCenter) { | 125 FirstRunNotShownWithMessageCenter) { |
129 TestingProfile profile; | 126 TestingProfile profile; |
130 notification_manager()->Add(GetANotification("test"), &profile); | 127 notification_manager()->Add(GetANotification("test"), &profile); |
131 message_center()->SetVisibility(message_center::VISIBILITY_MESSAGE_CENTER); | 128 message_center()->SetVisibility(message_center::VISIBILITY_MESSAGE_CENTER); |
132 run_loop()->RunUntilIdle(); | 129 run_loop()->RunUntilIdle(); |
133 EXPECT_FALSE(notification_manager()->FirstRunTimerIsActive()); | 130 EXPECT_FALSE(notification_manager()->FirstRunTimerIsActive()); |
134 EXPECT_FALSE(DidFirstRunPref()); | 131 EXPECT_FALSE(DidFirstRunPref()); |
135 } | 132 } |
136 } // namespace message_center | 133 } // namespace message_center |
OLD | NEW |