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 <map> | 5 #include <map> |
6 #include <string> | 6 #include <string> |
7 | 7 |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 data, | 145 data, |
146 new_delegate); | 146 new_delegate); |
147 } | 147 } |
148 }; | 148 }; |
149 | 149 |
150 // TODO(rsesek): Implement Message Center on Mac and get these tests passing | 150 // TODO(rsesek): Implement Message Center on Mac and get these tests passing |
151 // for real. http://crbug.com/179904 | 151 // for real. http://crbug.com/179904 |
152 #if !defined(OS_MACOSX) | 152 #if !defined(OS_MACOSX) |
153 | 153 |
154 IN_PROC_BROWSER_TEST_F(MessageCenterNotificationsTest, RetrieveBaseParts) { | 154 IN_PROC_BROWSER_TEST_F(MessageCenterNotificationsTest, RetrieveBaseParts) { |
155 // Make sure comamnd-line switch has an effect. | |
156 EXPECT_EQ(NotificationUIManager::DelegatesToMessageCenter(), | |
157 message_center::IsRichNotificationEnabled()); | |
158 EXPECT_TRUE(manager()); | 155 EXPECT_TRUE(manager()); |
159 EXPECT_TRUE(message_center()); | 156 EXPECT_TRUE(message_center()); |
160 } | 157 } |
161 | 158 |
162 // MessaceCenter-specific test. | 159 IN_PROC_BROWSER_TEST_F(MessageCenterNotificationsTest, BasicAddCancel) { |
163 #if defined(RUN_MESSAGE_CENTER_TESTS) | |
164 #define MAYBE_BasicAddCancel BasicAddCancel | |
165 #else | |
166 #define MAYBE_BasicAddCancel DISABLED_BasicAddCancel | |
167 #endif | |
168 | |
169 IN_PROC_BROWSER_TEST_F(MessageCenterNotificationsTest, MAYBE_BasicAddCancel) { | |
170 #if defined(OS_WIN) && defined(USE_ASH) | 160 #if defined(OS_WIN) && defined(USE_ASH) |
171 // Disable this test in Metro+Ash for now (http://crbug.com/262796). | 161 // Disable this test in Metro+Ash for now (http://crbug.com/262796). |
172 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kAshBrowserTests)) | 162 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kAshBrowserTests)) |
173 return; | 163 return; |
174 #endif | 164 #endif |
175 | 165 |
176 EXPECT_TRUE(NotificationUIManager::DelegatesToMessageCenter()); | |
177 // Someone may create system notifications like "you're in multi-profile | 166 // Someone may create system notifications like "you're in multi-profile |
178 // mode..." or something which may change the expectation. | 167 // mode..." or something which may change the expectation. |
179 // TODO(mukai): move this to SetUpOnMainThread() after fixing the side-effect | 168 // TODO(mukai): move this to SetUpOnMainThread() after fixing the side-effect |
180 // of canceling animation which prevents some Displayed() event. | 169 // of canceling animation which prevents some Displayed() event. |
181 manager()->CancelAll(); | 170 manager()->CancelAll(); |
182 manager()->Add(CreateTestNotification("hey"), profile()); | 171 manager()->Add(CreateTestNotification("hey"), profile()); |
183 EXPECT_EQ(1u, message_center()->NotificationCount()); | 172 EXPECT_EQ(1u, message_center()->NotificationCount()); |
184 manager()->CancelById("hey"); | 173 manager()->CancelById("hey"); |
185 EXPECT_EQ(0u, message_center()->NotificationCount()); | 174 EXPECT_EQ(0u, message_center()->NotificationCount()); |
186 } | 175 } |
187 | 176 |
188 // MessaceCenter-specific test. | 177 IN_PROC_BROWSER_TEST_F(MessageCenterNotificationsTest, BasicDelegate) { |
189 #if defined(RUN_MESSAGE_CENTER_TESTS) | |
190 #define MAYBE_BasicDelegate BasicDelegate | |
191 #else | |
192 #define MAYBE_BasicDelegate DISABLED_BasicDelegate | |
193 #endif | |
194 | |
195 IN_PROC_BROWSER_TEST_F(MessageCenterNotificationsTest, MAYBE_BasicDelegate) { | |
196 #if defined(OS_WIN) && defined(USE_ASH) | 178 #if defined(OS_WIN) && defined(USE_ASH) |
197 // Disable this test in Metro+Ash for now (http://crbug.com/262796). | 179 // Disable this test in Metro+Ash for now (http://crbug.com/262796). |
198 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kAshBrowserTests)) | 180 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kAshBrowserTests)) |
199 return; | 181 return; |
200 #endif | 182 #endif |
201 | 183 |
202 EXPECT_TRUE(NotificationUIManager::DelegatesToMessageCenter()); | |
203 TestDelegate* delegate; | 184 TestDelegate* delegate; |
204 manager()->Add(CreateTestNotification("hey", &delegate), profile()); | 185 manager()->Add(CreateTestNotification("hey", &delegate), profile()); |
205 // Verify that delegate accumulated correct log of events. | 186 // Verify that delegate accumulated correct log of events. |
206 EXPECT_EQ("Display_", delegate->log()); | 187 EXPECT_EQ("Display_", delegate->log()); |
207 manager()->CancelById("hey"); | 188 manager()->CancelById("hey"); |
208 // Verify that delegate accumulated correct log of events. | 189 // Verify that delegate accumulated correct log of events. |
209 EXPECT_EQ("Display_Close_programmatically_", delegate->log()); | 190 EXPECT_EQ("Display_Close_programmatically_", delegate->log()); |
210 delegate->Release(); | 191 delegate->Release(); |
211 } | 192 } |
212 | 193 |
213 // MessaceCenter-specific test. | 194 IN_PROC_BROWSER_TEST_F(MessageCenterNotificationsTest, ButtonClickedDelegate) { |
214 #if defined(RUN_MESSAGE_CENTER_TESTS) | |
215 #define MAYBE_ButtonClickedDelegate ButtonClickedDelegate | |
216 #else | |
217 #define MAYBE_ButtonClickedDelegate DISABLED_ButtonClickedDelegate | |
218 #endif | |
219 | |
220 IN_PROC_BROWSER_TEST_F(MessageCenterNotificationsTest, | |
221 MAYBE_ButtonClickedDelegate) { | |
222 #if defined(OS_WIN) && defined(USE_ASH) | 195 #if defined(OS_WIN) && defined(USE_ASH) |
223 // Disable this test in Metro+Ash for now (http://crbug.com/262796). | 196 // Disable this test in Metro+Ash for now (http://crbug.com/262796). |
224 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kAshBrowserTests)) | 197 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kAshBrowserTests)) |
225 return; | 198 return; |
226 #endif | 199 #endif |
227 | 200 |
228 EXPECT_TRUE(NotificationUIManager::DelegatesToMessageCenter()); | |
229 TestDelegate* delegate; | 201 TestDelegate* delegate; |
230 manager()->Add(CreateTestNotification("n", &delegate), profile()); | 202 manager()->Add(CreateTestNotification("n", &delegate), profile()); |
231 message_center()->ClickOnNotificationButton("n", 1); | 203 message_center()->ClickOnNotificationButton("n", 1); |
232 // Verify that delegate accumulated correct log of events. | 204 // Verify that delegate accumulated correct log of events. |
233 EXPECT_EQ("Display_ButtonClick_1_", delegate->log()); | 205 EXPECT_EQ("Display_ButtonClick_1_", delegate->log()); |
234 delegate->Release(); | 206 delegate->Release(); |
235 } | 207 } |
236 | 208 |
237 // MessaceCenter-specific test. | |
238 #if defined(RUN_MESSAGE_CENTER_TESTS) | |
239 #define MAYBE_UpdateExistingNotification UpdateExistingNotification | |
240 #else | |
241 #define MAYBE_UpdateExistingNotification DISABLED_UpdateExistingNotification | |
242 #endif | |
243 | |
244 IN_PROC_BROWSER_TEST_F(MessageCenterNotificationsTest, | 209 IN_PROC_BROWSER_TEST_F(MessageCenterNotificationsTest, |
245 MAYBE_UpdateExistingNotification) { | 210 UpdateExistingNotification) { |
246 #if defined(OS_WIN) && defined(USE_ASH) | 211 #if defined(OS_WIN) && defined(USE_ASH) |
247 // Disable this test in Metro+Ash for now (http://crbug.com/262796). | 212 // Disable this test in Metro+Ash for now (http://crbug.com/262796). |
248 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kAshBrowserTests)) | 213 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kAshBrowserTests)) |
249 return; | 214 return; |
250 #endif | 215 #endif |
251 | 216 |
252 EXPECT_TRUE(NotificationUIManager::DelegatesToMessageCenter()); | |
253 TestDelegate* delegate; | 217 TestDelegate* delegate; |
254 manager()->Add(CreateTestNotification("n", &delegate), profile()); | 218 manager()->Add(CreateTestNotification("n", &delegate), profile()); |
255 TestDelegate* delegate2; | 219 TestDelegate* delegate2; |
256 manager()->Add(CreateRichTestNotification("n", &delegate2), profile()); | 220 manager()->Add(CreateRichTestNotification("n", &delegate2), profile()); |
257 | 221 |
258 manager()->CancelById("n"); | 222 manager()->CancelById("n"); |
259 EXPECT_EQ("Display_", delegate->log()); | 223 EXPECT_EQ("Display_", delegate->log()); |
260 EXPECT_EQ("Close_programmatically_", delegate2->log()); | 224 EXPECT_EQ("Close_programmatically_", delegate2->log()); |
261 | 225 |
262 delegate->Release(); | 226 delegate->Release(); |
263 delegate2->Release(); | 227 delegate2->Release(); |
264 } | 228 } |
265 | 229 |
266 // MessaceCenter-specific test. | 230 IN_PROC_BROWSER_TEST_F(MessageCenterNotificationsTest, QueueWhenCenterVisible) { |
267 #if defined(RUN_MESSAGE_CENTER_TESTS) | |
268 #define MAYBE_QueueWhenCenterVisible QueueWhenCenterVisible | |
269 #else | |
270 #define MAYBE_QueueWhenCenterVisible DISABLED_QueueWhenCenterVisible | |
271 #endif | |
272 | |
273 IN_PROC_BROWSER_TEST_F(MessageCenterNotificationsTest, | |
274 MAYBE_QueueWhenCenterVisible) { | |
275 #if defined(OS_WIN) && defined(USE_ASH) | 231 #if defined(OS_WIN) && defined(USE_ASH) |
276 // Disable this test in Metro+Ash for now (http://crbug.com/262796). | 232 // Disable this test in Metro+Ash for now (http://crbug.com/262796). |
277 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kAshBrowserTests)) | 233 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kAshBrowserTests)) |
278 return; | 234 return; |
279 #endif | 235 #endif |
280 | 236 |
281 EXPECT_TRUE(NotificationUIManager::DelegatesToMessageCenter()); | |
282 TestAddObserver observer(message_center()); | 237 TestAddObserver observer(message_center()); |
283 | 238 |
284 TestDelegate* delegate; | 239 TestDelegate* delegate; |
285 TestDelegate* delegate2; | 240 TestDelegate* delegate2; |
286 | 241 |
287 manager()->Add(CreateTestNotification("n", &delegate), profile()); | 242 manager()->Add(CreateTestNotification("n", &delegate), profile()); |
288 message_center()->SetVisibility(message_center::VISIBILITY_MESSAGE_CENTER); | 243 message_center()->SetVisibility(message_center::VISIBILITY_MESSAGE_CENTER); |
289 manager()->Add(CreateTestNotification("n2", &delegate2), profile()); | 244 manager()->Add(CreateTestNotification("n2", &delegate2), profile()); |
290 | 245 |
291 // 'update-n' should happen since SetVisibility updates is_read status of n. | 246 // 'update-n' should happen since SetVisibility updates is_read status of n. |
292 // TODO(mukai): fix event handling to happen update-n just once. | 247 // TODO(mukai): fix event handling to happen update-n just once. |
293 EXPECT_EQ("add-n_update-n_update-n", observer.log("n")); | 248 EXPECT_EQ("add-n_update-n_update-n", observer.log("n")); |
294 | 249 |
295 message_center()->SetVisibility(message_center::VISIBILITY_TRANSIENT); | 250 message_center()->SetVisibility(message_center::VISIBILITY_TRANSIENT); |
296 | 251 |
297 EXPECT_EQ("add-n2", observer.log("n2")); | 252 EXPECT_EQ("add-n2", observer.log("n2")); |
298 | 253 |
299 delegate->Release(); | 254 delegate->Release(); |
300 delegate2->Release(); | 255 delegate2->Release(); |
301 } | 256 } |
302 | 257 |
303 // MessaceCenter-specific test. | |
304 #if defined(RUN_MESSAGE_CENTER_TESTS) | |
305 #define MAYBE_UpdateNonProgressNotificationWhenCenterVisible \ | |
306 UpdateNonProgressNotificationWhenCenterVisible | |
307 #else | |
308 #define MAYBE_UpdateNonProgressNotificationWhenCenterVisible \ | |
309 DISABLED_UpdateNonProgressNotificationWhenCenterVisible | |
310 #endif | |
311 | |
312 IN_PROC_BROWSER_TEST_F(MessageCenterNotificationsTest, | 258 IN_PROC_BROWSER_TEST_F(MessageCenterNotificationsTest, |
313 MAYBE_UpdateNonProgressNotificationWhenCenterVisible) { | 259 UpdateNonProgressNotificationWhenCenterVisible) { |
314 #if defined(OS_WIN) && defined(USE_ASH) | 260 #if defined(OS_WIN) && defined(USE_ASH) |
315 // Disable this test in Metro+Ash for now (http://crbug.com/262796). | 261 // Disable this test in Metro+Ash for now (http://crbug.com/262796). |
316 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kAshBrowserTests)) | 262 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kAshBrowserTests)) |
317 return; | 263 return; |
318 #endif | 264 #endif |
319 | 265 |
320 EXPECT_TRUE(NotificationUIManager::DelegatesToMessageCenter()); | |
321 TestAddObserver observer(message_center()); | 266 TestAddObserver observer(message_center()); |
322 | 267 |
323 TestDelegate* delegate; | 268 TestDelegate* delegate; |
324 | 269 |
325 // Add a non-progress notification and update it while the message center | 270 // Add a non-progress notification and update it while the message center |
326 // is visible. | 271 // is visible. |
327 Notification notification = CreateTestNotification("n", &delegate); | 272 Notification notification = CreateTestNotification("n", &delegate); |
328 manager()->Add(notification, profile()); | 273 manager()->Add(notification, profile()); |
329 message_center()->ClickOnNotification("n"); | 274 message_center()->ClickOnNotification("n"); |
330 message_center()->SetVisibility(message_center::VISIBILITY_MESSAGE_CENTER); | 275 message_center()->SetVisibility(message_center::VISIBILITY_MESSAGE_CENTER); |
331 observer.reset_logs(); | 276 observer.reset_logs(); |
332 notification.set_title(base::ASCIIToUTF16("title2")); | 277 notification.set_title(base::ASCIIToUTF16("title2")); |
333 manager()->Update(notification, profile()); | 278 manager()->Update(notification, profile()); |
334 | 279 |
335 // Expect that the notification update is not done. | 280 // Expect that the notification update is not done. |
336 EXPECT_EQ("", observer.log("n")); | 281 EXPECT_EQ("", observer.log("n")); |
337 | 282 |
338 message_center()->SetVisibility(message_center::VISIBILITY_TRANSIENT); | 283 message_center()->SetVisibility(message_center::VISIBILITY_TRANSIENT); |
339 EXPECT_EQ("update-n", observer.log("n")); | 284 EXPECT_EQ("update-n", observer.log("n")); |
340 | 285 |
341 delegate->Release(); | 286 delegate->Release(); |
342 } | 287 } |
343 | 288 |
344 // MessaceCenter-specific test. | |
345 #if defined(RUN_MESSAGE_CENTER_TESTS) | |
346 #define MAYBE_UpdateNonProgressToProgressNotificationWhenCenterVisible \ | |
347 UpdateNonProgressToProgressNotificationWhenCenterVisible | |
348 #else | |
349 #define MAYBE_UpdateNonProgressToProgressNotificationWhenCenterVisible \ | |
350 DISABLED_UpdateNonProgressToProgressNotificationWhenCenterVisible | |
351 #endif | |
352 | |
353 IN_PROC_BROWSER_TEST_F( | 289 IN_PROC_BROWSER_TEST_F( |
354 MessageCenterNotificationsTest, | 290 MessageCenterNotificationsTest, |
355 MAYBE_UpdateNonProgressToProgressNotificationWhenCenterVisible) { | 291 UpdateNonProgressToProgressNotificationWhenCenterVisible) { |
356 #if defined(OS_WIN) && defined(USE_ASH) | 292 #if defined(OS_WIN) && defined(USE_ASH) |
357 // Disable this test in Metro+Ash for now (http://crbug.com/262796). | 293 // Disable this test in Metro+Ash for now (http://crbug.com/262796). |
358 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kAshBrowserTests)) | 294 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kAshBrowserTests)) |
359 return; | 295 return; |
360 #endif | 296 #endif |
361 | 297 |
362 EXPECT_TRUE(NotificationUIManager::DelegatesToMessageCenter()); | |
363 TestAddObserver observer(message_center()); | 298 TestAddObserver observer(message_center()); |
364 | 299 |
365 TestDelegate* delegate; | 300 TestDelegate* delegate; |
366 | 301 |
367 // Add a non-progress notification and change the type to progress while the | 302 // Add a non-progress notification and change the type to progress while the |
368 // message center is visible. | 303 // message center is visible. |
369 Notification notification = CreateTestNotification("n", &delegate); | 304 Notification notification = CreateTestNotification("n", &delegate); |
370 manager()->Add(notification, profile()); | 305 manager()->Add(notification, profile()); |
371 message_center()->ClickOnNotification("n"); | 306 message_center()->ClickOnNotification("n"); |
372 message_center()->SetVisibility(message_center::VISIBILITY_MESSAGE_CENTER); | 307 message_center()->SetVisibility(message_center::VISIBILITY_MESSAGE_CENTER); |
373 observer.reset_logs(); | 308 observer.reset_logs(); |
374 notification.set_type(message_center::NOTIFICATION_TYPE_PROGRESS); | 309 notification.set_type(message_center::NOTIFICATION_TYPE_PROGRESS); |
375 manager()->Update(notification, profile()); | 310 manager()->Update(notification, profile()); |
376 | 311 |
377 // Expect that the notification update is not done. | 312 // Expect that the notification update is not done. |
378 EXPECT_EQ("", observer.log("n")); | 313 EXPECT_EQ("", observer.log("n")); |
379 | 314 |
380 message_center()->SetVisibility(message_center::VISIBILITY_TRANSIENT); | 315 message_center()->SetVisibility(message_center::VISIBILITY_TRANSIENT); |
381 EXPECT_EQ("update-n", observer.log("n")); | 316 EXPECT_EQ("update-n", observer.log("n")); |
382 | 317 |
383 delegate->Release(); | 318 delegate->Release(); |
384 } | 319 } |
385 | 320 |
386 // MessaceCenter-specific test. | |
387 #if defined(RUN_MESSAGE_CENTER_TESTS) | |
388 #define MAYBE_UpdateProgressNotificationWhenCenterVisible \ | |
389 UpdateProgressNotificationWhenCenterVisible | |
390 #else | |
391 #define MAYBE_UpdateProgressNotificationWhenCenterVisible \ | |
392 DISABLED_UpdateProgressNotificationWhenCenterVisible | |
393 #endif | |
394 | |
395 IN_PROC_BROWSER_TEST_F(MessageCenterNotificationsTest, | 321 IN_PROC_BROWSER_TEST_F(MessageCenterNotificationsTest, |
396 MAYBE_UpdateProgressNotificationWhenCenterVisible) { | 322 UpdateProgressNotificationWhenCenterVisible) { |
397 #if defined(OS_WIN) && defined(USE_ASH) | 323 #if defined(OS_WIN) && defined(USE_ASH) |
398 // Disable this test in Metro+Ash for now (http://crbug.com/262796). | 324 // Disable this test in Metro+Ash for now (http://crbug.com/262796). |
399 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kAshBrowserTests)) | 325 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kAshBrowserTests)) |
400 return; | 326 return; |
401 #endif | 327 #endif |
402 | 328 |
403 EXPECT_TRUE(NotificationUIManager::DelegatesToMessageCenter()); | |
404 TestAddObserver observer(message_center()); | 329 TestAddObserver observer(message_center()); |
405 | 330 |
406 TestDelegate* delegate; | 331 TestDelegate* delegate; |
407 | 332 |
408 // Add a progress notification and update it while the message center | 333 // Add a progress notification and update it while the message center |
409 // is visible. | 334 // is visible. |
410 Notification notification = CreateTestNotification("n", &delegate); | 335 Notification notification = CreateTestNotification("n", &delegate); |
411 notification.set_type(message_center::NOTIFICATION_TYPE_PROGRESS); | 336 notification.set_type(message_center::NOTIFICATION_TYPE_PROGRESS); |
412 manager()->Add(notification, profile()); | 337 manager()->Add(notification, profile()); |
413 message_center()->ClickOnNotification("n"); | 338 message_center()->ClickOnNotification("n"); |
414 message_center()->SetVisibility(message_center::VISIBILITY_MESSAGE_CENTER); | 339 message_center()->SetVisibility(message_center::VISIBILITY_MESSAGE_CENTER); |
415 observer.reset_logs(); | 340 observer.reset_logs(); |
416 notification.set_progress(50); | 341 notification.set_progress(50); |
417 manager()->Update(notification, profile()); | 342 manager()->Update(notification, profile()); |
418 | 343 |
419 // Expect that the progress notification update is performed. | 344 // Expect that the progress notification update is performed. |
420 EXPECT_EQ("update-n", observer.log("n")); | 345 EXPECT_EQ("update-n", observer.log("n")); |
421 | 346 |
422 delegate->Release(); | 347 delegate->Release(); |
423 } | 348 } |
424 | 349 |
425 #if !defined(OS_CHROMEOS) && defined(RUN_MESSAGE_CENTER_TESTS) | 350 #if !defined(OS_CHROMEOS) |
426 #define MAYBE_HideWhenFullscreenEnabled HideWhenFullscreenEnabled | 351 #define MAYBE_HideWhenFullscreenEnabled HideWhenFullscreenEnabled |
427 #else | 352 #else |
428 #define MAYBE_HideWhenFullscreenEnabled DISABLED_HideWhenFullscreenEnabled | 353 #define MAYBE_HideWhenFullscreenEnabled DISABLED_HideWhenFullscreenEnabled |
429 #endif | 354 #endif |
430 | 355 |
431 IN_PROC_BROWSER_TEST_F(MessageCenterNotificationsTest, | 356 IN_PROC_BROWSER_TEST_F(MessageCenterNotificationsTest, |
432 MAYBE_HideWhenFullscreenEnabled) { | 357 MAYBE_HideWhenFullscreenEnabled) { |
433 EXPECT_TRUE(NotificationUIManager::DelegatesToMessageCenter()); | |
434 | |
435 TestDelegate* delegate; | 358 TestDelegate* delegate; |
436 manager()->Add(CreateTestNotification("n", &delegate), profile()); | 359 manager()->Add(CreateTestNotification("n", &delegate), profile()); |
437 | 360 |
438 EXPECT_EQ("Display_", delegate->log()); | 361 EXPECT_EQ("Display_", delegate->log()); |
439 EXPECT_TRUE(message_center()->HasPopupNotifications()); | 362 EXPECT_TRUE(message_center()->HasPopupNotifications()); |
440 bool is_fullscreen = true; | 363 bool is_fullscreen = true; |
441 // Cast so that Observe() is public. | 364 // Cast so that Observe() is public. |
442 content::NotificationObserver* observer = | 365 content::NotificationObserver* observer = |
443 static_cast<content::NotificationObserver*>(manager()); | 366 static_cast<content::NotificationObserver*>(manager()); |
444 observer->Observe(chrome::NOTIFICATION_FULLSCREEN_CHANGED, | 367 observer->Observe(chrome::NOTIFICATION_FULLSCREEN_CHANGED, |
445 content::Source<Profile>(profile()), | 368 content::Source<Profile>(profile()), |
446 content::Details<bool>(&is_fullscreen)); | 369 content::Details<bool>(&is_fullscreen)); |
447 EXPECT_FALSE(message_center()->HasPopupNotifications()); | 370 EXPECT_FALSE(message_center()->HasPopupNotifications()); |
448 } | 371 } |
449 | 372 |
450 #endif // !defined(OS_MACOSX) | 373 #endif // !defined(OS_MACOSX) |
OLD | NEW |