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" |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 TestingProfile profile; | 98 TestingProfile profile; |
99 notification_manager()->Add(GetANotification("test"), &profile); | 99 notification_manager()->Add(GetANotification("test"), &profile); |
100 EXPECT_FALSE(DidFirstRunPref()); | 100 EXPECT_FALSE(DidFirstRunPref()); |
101 } | 101 } |
102 | 102 |
103 // The following tests test the first run balloon, which is only implemented for | 103 // The following tests test the first run balloon, which is only implemented for |
104 // Windows. | 104 // Windows. |
105 TEST_F(MessageCenterNotificationManagerTest, FirstRunShown) { | 105 TEST_F(MessageCenterNotificationManagerTest, FirstRunShown) { |
106 TestingProfile profile; | 106 TestingProfile profile; |
107 notification_manager()->Add(GetANotification("test"), &profile); | 107 notification_manager()->Add(GetANotification("test"), &profile); |
108 message_center()->DisplayedNotification("test"); | 108 message_center()->DisplayedNotification( |
| 109 "test", message_center::DISPLAY_SOURCE_MESSAGE_CENTER); |
109 message_center()->MarkSinglePopupAsShown("test", false); | 110 message_center()->MarkSinglePopupAsShown("test", false); |
110 | 111 |
111 run_loop()->Run(); | 112 run_loop()->Run(); |
112 base::RunLoop run_loop_2; | 113 base::RunLoop run_loop_2; |
113 run_loop_2.RunUntilIdle(); | 114 run_loop_2.RunUntilIdle(); |
114 EXPECT_TRUE(delegate()->displayed_first_run_balloon()); | 115 EXPECT_TRUE(delegate()->displayed_first_run_balloon()); |
115 EXPECT_TRUE(DidFirstRunPref()); | 116 EXPECT_TRUE(DidFirstRunPref()); |
116 } | 117 } |
117 | 118 |
118 TEST_F(MessageCenterNotificationManagerTest, | 119 TEST_F(MessageCenterNotificationManagerTest, |
119 FirstRunNotShownWithPopupsVisible) { | 120 FirstRunNotShownWithPopupsVisible) { |
120 TestingProfile profile; | 121 TestingProfile profile; |
121 notification_manager()->Add(GetANotification("test"), &profile); | 122 notification_manager()->Add(GetANotification("test"), &profile); |
122 message_center()->DisplayedNotification("test"); | 123 message_center()->DisplayedNotification( |
| 124 "test", message_center::DISPLAY_SOURCE_MESSAGE_CENTER); |
123 run_loop()->RunUntilIdle(); | 125 run_loop()->RunUntilIdle(); |
124 EXPECT_FALSE(delegate()->displayed_first_run_balloon()); | 126 EXPECT_FALSE(delegate()->displayed_first_run_balloon()); |
125 EXPECT_FALSE(notification_manager()->FirstRunTimerIsActive()); | 127 EXPECT_FALSE(notification_manager()->FirstRunTimerIsActive()); |
126 EXPECT_FALSE(DidFirstRunPref()); | 128 EXPECT_FALSE(DidFirstRunPref()); |
127 } | 129 } |
128 | 130 |
129 TEST_F(MessageCenterNotificationManagerTest, | 131 TEST_F(MessageCenterNotificationManagerTest, |
130 FirstRunNotShownWithMessageCenter) { | 132 FirstRunNotShownWithMessageCenter) { |
131 TestingProfile profile; | 133 TestingProfile profile; |
132 notification_manager()->Add(GetANotification("test"), &profile); | 134 notification_manager()->Add(GetANotification("test"), &profile); |
133 message_center()->SetVisibility(message_center::VISIBILITY_MESSAGE_CENTER); | 135 message_center()->SetVisibility(message_center::VISIBILITY_MESSAGE_CENTER); |
134 run_loop()->RunUntilIdle(); | 136 run_loop()->RunUntilIdle(); |
135 EXPECT_FALSE(notification_manager()->FirstRunTimerIsActive()); | 137 EXPECT_FALSE(notification_manager()->FirstRunTimerIsActive()); |
136 EXPECT_FALSE(DidFirstRunPref()); | 138 EXPECT_FALSE(DidFirstRunPref()); |
137 } | 139 } |
138 } // namespace message_center | 140 } // namespace message_center |
OLD | NEW |