| 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 "ui/message_center/message_center_impl.h" | 5 #include "ui/message_center/message_center_impl.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
| 9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 return CreateNotificationWithNotifierId(id, "app1", type); | 74 return CreateNotificationWithNotifierId(id, "app1", type); |
| 75 } | 75 } |
| 76 | 76 |
| 77 Notification* CreateNotificationWithNotifierId( | 77 Notification* CreateNotificationWithNotifierId( |
| 78 const std::string& id, | 78 const std::string& id, |
| 79 const std::string& notifier_id, | 79 const std::string& notifier_id, |
| 80 message_center::NotificationType type) { | 80 message_center::NotificationType type) { |
| 81 RichNotificationData optional_fields; | 81 RichNotificationData optional_fields; |
| 82 optional_fields.buttons.push_back(ButtonInfo(UTF8ToUTF16("foo"))); | 82 optional_fields.buttons.push_back(ButtonInfo(UTF8ToUTF16("foo"))); |
| 83 optional_fields.buttons.push_back(ButtonInfo(UTF8ToUTF16("foo"))); | 83 optional_fields.buttons.push_back(ButtonInfo(UTF8ToUTF16("foo"))); |
| 84 return new Notification(type, | 84 return new Notification(type, id, UTF8ToUTF16("title"), UTF8ToUTF16(id), |
| 85 id, | |
| 86 UTF8ToUTF16("title"), | |
| 87 UTF8ToUTF16(id), | |
| 88 gfx::Image() /* icon */, | 85 gfx::Image() /* icon */, |
| 89 base::string16() /* display_source */, | 86 base::string16() /* display_source */, GURL(), |
| 90 NotifierId(NotifierId::APPLICATION, notifier_id), | 87 NotifierId(NotifierId::APPLICATION, notifier_id), |
| 91 optional_fields, | 88 optional_fields, NULL); |
| 92 NULL); | |
| 93 } | 89 } |
| 94 | 90 |
| 95 | 91 |
| 96 private: | 92 private: |
| 97 MessageCenter* message_center_; | 93 MessageCenter* message_center_; |
| 98 scoped_ptr<base::MessageLoop> loop_; | 94 scoped_ptr<base::MessageLoop> loop_; |
| 99 scoped_ptr<base::RunLoop> run_loop_; | 95 scoped_ptr<base::RunLoop> run_loop_; |
| 100 base::Closure closure_; | 96 base::Closure closure_; |
| 101 | 97 |
| 102 DISALLOW_COPY_AND_ASSIGN(MessageCenterImplTest); | 98 DISALLOW_COPY_AND_ASSIGN(MessageCenterImplTest); |
| (...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 344 EXPECT_TRUE(popup_timers_controller->timer_finished()); | 340 EXPECT_TRUE(popup_timers_controller->timer_finished()); |
| 345 } | 341 } |
| 346 | 342 |
| 347 TEST_F(MessageCenterImplTest, NotificationBlocker) { | 343 TEST_F(MessageCenterImplTest, NotificationBlocker) { |
| 348 NotifierId notifier_id(NotifierId::APPLICATION, "app1"); | 344 NotifierId notifier_id(NotifierId::APPLICATION, "app1"); |
| 349 // Multiple blockers to verify the case that one blocker blocks but another | 345 // Multiple blockers to verify the case that one blocker blocks but another |
| 350 // doesn't. | 346 // doesn't. |
| 351 ToggledNotificationBlocker blocker1(message_center()); | 347 ToggledNotificationBlocker blocker1(message_center()); |
| 352 ToggledNotificationBlocker blocker2(message_center()); | 348 ToggledNotificationBlocker blocker2(message_center()); |
| 353 | 349 |
| 354 message_center()->AddNotification(scoped_ptr<Notification>(new Notification( | 350 message_center()->AddNotification(scoped_ptr<Notification>( |
| 355 NOTIFICATION_TYPE_SIMPLE, | 351 new Notification(NOTIFICATION_TYPE_SIMPLE, "id1", UTF8ToUTF16("title"), |
| 356 "id1", | 352 UTF8ToUTF16("message"), gfx::Image() /* icon */, |
| 357 UTF8ToUTF16("title"), | 353 base::string16() /* display_source */, GURL(), |
| 358 UTF8ToUTF16("message"), | 354 notifier_id, RichNotificationData(), NULL))); |
| 359 gfx::Image() /* icon */, | 355 message_center()->AddNotification(scoped_ptr<Notification>( |
| 360 base::string16() /* display_source */, | 356 new Notification(NOTIFICATION_TYPE_SIMPLE, "id2", UTF8ToUTF16("title"), |
| 361 notifier_id, | 357 UTF8ToUTF16("message"), gfx::Image() /* icon */, |
| 362 RichNotificationData(), | 358 base::string16() /* display_source */, GURL(), |
| 363 NULL))); | 359 notifier_id, RichNotificationData(), NULL))); |
| 364 message_center()->AddNotification(scoped_ptr<Notification>(new Notification( | |
| 365 NOTIFICATION_TYPE_SIMPLE, | |
| 366 "id2", | |
| 367 UTF8ToUTF16("title"), | |
| 368 UTF8ToUTF16("message"), | |
| 369 gfx::Image() /* icon */, | |
| 370 base::string16() /* display_source */, | |
| 371 notifier_id, | |
| 372 RichNotificationData(), | |
| 373 NULL))); | |
| 374 EXPECT_EQ(2u, message_center()->GetPopupNotifications().size()); | 360 EXPECT_EQ(2u, message_center()->GetPopupNotifications().size()); |
| 375 EXPECT_EQ(2u, message_center()->GetVisibleNotifications().size()); | 361 EXPECT_EQ(2u, message_center()->GetVisibleNotifications().size()); |
| 376 | 362 |
| 377 // Block all notifications. All popups are gone and message center should be | 363 // Block all notifications. All popups are gone and message center should be |
| 378 // hidden. | 364 // hidden. |
| 379 blocker1.SetNotificationsEnabled(false); | 365 blocker1.SetNotificationsEnabled(false); |
| 380 EXPECT_TRUE(message_center()->GetPopupNotifications().empty()); | 366 EXPECT_TRUE(message_center()->GetPopupNotifications().empty()); |
| 381 EXPECT_EQ(2u, message_center()->GetVisibleNotifications().size()); | 367 EXPECT_EQ(2u, message_center()->GetVisibleNotifications().size()); |
| 382 | 368 |
| 383 // Updates |blocker2| state, which doesn't affect the global state. | 369 // Updates |blocker2| state, which doesn't affect the global state. |
| (...skipping 16 matching lines...) Expand all Loading... |
| 400 // aren't shown. | 386 // aren't shown. |
| 401 blocker2.SetNotificationsEnabled(true); | 387 blocker2.SetNotificationsEnabled(true); |
| 402 EXPECT_TRUE(message_center()->GetPopupNotifications().empty()); | 388 EXPECT_TRUE(message_center()->GetPopupNotifications().empty()); |
| 403 EXPECT_EQ(2u, message_center()->GetVisibleNotifications().size()); | 389 EXPECT_EQ(2u, message_center()->GetVisibleNotifications().size()); |
| 404 } | 390 } |
| 405 | 391 |
| 406 TEST_F(MessageCenterImplTest, NotificationsDuringBlocked) { | 392 TEST_F(MessageCenterImplTest, NotificationsDuringBlocked) { |
| 407 NotifierId notifier_id(NotifierId::APPLICATION, "app1"); | 393 NotifierId notifier_id(NotifierId::APPLICATION, "app1"); |
| 408 ToggledNotificationBlocker blocker(message_center()); | 394 ToggledNotificationBlocker blocker(message_center()); |
| 409 | 395 |
| 410 message_center()->AddNotification(scoped_ptr<Notification>(new Notification( | 396 message_center()->AddNotification(scoped_ptr<Notification>( |
| 411 NOTIFICATION_TYPE_SIMPLE, | 397 new Notification(NOTIFICATION_TYPE_SIMPLE, "id1", UTF8ToUTF16("title"), |
| 412 "id1", | 398 UTF8ToUTF16("message"), gfx::Image() /* icon */, |
| 413 UTF8ToUTF16("title"), | 399 base::string16() /* display_source */, GURL(), |
| 414 UTF8ToUTF16("message"), | 400 notifier_id, RichNotificationData(), NULL))); |
| 415 gfx::Image() /* icon */, | |
| 416 base::string16() /* display_source */, | |
| 417 notifier_id, | |
| 418 RichNotificationData(), | |
| 419 NULL))); | |
| 420 EXPECT_EQ(1u, message_center()->GetPopupNotifications().size()); | 401 EXPECT_EQ(1u, message_center()->GetPopupNotifications().size()); |
| 421 EXPECT_EQ(1u, message_center()->GetVisibleNotifications().size()); | 402 EXPECT_EQ(1u, message_center()->GetVisibleNotifications().size()); |
| 422 | 403 |
| 423 // Create a notification during blocked. Still no popups. | 404 // Create a notification during blocked. Still no popups. |
| 424 blocker.SetNotificationsEnabled(false); | 405 blocker.SetNotificationsEnabled(false); |
| 425 message_center()->AddNotification(scoped_ptr<Notification>(new Notification( | 406 message_center()->AddNotification(scoped_ptr<Notification>( |
| 426 NOTIFICATION_TYPE_SIMPLE, | 407 new Notification(NOTIFICATION_TYPE_SIMPLE, "id2", UTF8ToUTF16("title"), |
| 427 "id2", | 408 UTF8ToUTF16("message"), gfx::Image() /* icon */, |
| 428 UTF8ToUTF16("title"), | 409 base::string16() /* display_source */, GURL(), |
| 429 UTF8ToUTF16("message"), | 410 notifier_id, RichNotificationData(), NULL))); |
| 430 gfx::Image() /* icon */, | |
| 431 base::string16() /* display_source */, | |
| 432 notifier_id, | |
| 433 RichNotificationData(), | |
| 434 NULL))); | |
| 435 EXPECT_TRUE(message_center()->GetPopupNotifications().empty()); | 411 EXPECT_TRUE(message_center()->GetPopupNotifications().empty()); |
| 436 EXPECT_EQ(2u, message_center()->GetVisibleNotifications().size()); | 412 EXPECT_EQ(2u, message_center()->GetVisibleNotifications().size()); |
| 437 | 413 |
| 438 // Unblock notifications, the id1 should appear as a popup. | 414 // Unblock notifications, the id1 should appear as a popup. |
| 439 blocker.SetNotificationsEnabled(true); | 415 blocker.SetNotificationsEnabled(true); |
| 440 NotificationList::PopupNotifications popups = | 416 NotificationList::PopupNotifications popups = |
| 441 message_center()->GetPopupNotifications(); | 417 message_center()->GetPopupNotifications(); |
| 442 EXPECT_EQ(1u, popups.size()); | 418 EXPECT_EQ(1u, popups.size()); |
| 443 EXPECT_TRUE(PopupNotificationsContain(popups, "id2")); | 419 EXPECT_TRUE(PopupNotificationsContain(popups, "id2")); |
| 444 EXPECT_EQ(2u, message_center()->GetVisibleNotifications().size()); | 420 EXPECT_EQ(2u, message_center()->GetVisibleNotifications().size()); |
| 445 } | 421 } |
| 446 | 422 |
| 447 // Similar to other blocker cases but this test case allows |notifier_id2| even | 423 // Similar to other blocker cases but this test case allows |notifier_id2| even |
| 448 // in blocked. | 424 // in blocked. |
| 449 TEST_F(MessageCenterImplTest, NotificationBlockerAllowsPopups) { | 425 TEST_F(MessageCenterImplTest, NotificationBlockerAllowsPopups) { |
| 450 NotifierId notifier_id1(NotifierId::APPLICATION, "app1"); | 426 NotifierId notifier_id1(NotifierId::APPLICATION, "app1"); |
| 451 NotifierId notifier_id2(NotifierId::APPLICATION, "app2"); | 427 NotifierId notifier_id2(NotifierId::APPLICATION, "app2"); |
| 452 PopupNotificationBlocker blocker(message_center(), notifier_id2); | 428 PopupNotificationBlocker blocker(message_center(), notifier_id2); |
| 453 | 429 |
| 454 message_center()->AddNotification(scoped_ptr<Notification>(new Notification( | 430 message_center()->AddNotification(scoped_ptr<Notification>( |
| 455 NOTIFICATION_TYPE_SIMPLE, | 431 new Notification(NOTIFICATION_TYPE_SIMPLE, "id1", UTF8ToUTF16("title"), |
| 456 "id1", | 432 UTF8ToUTF16("message"), gfx::Image() /* icon */, |
| 457 UTF8ToUTF16("title"), | 433 base::string16() /* display_source */, GURL(), |
| 458 UTF8ToUTF16("message"), | 434 notifier_id1, RichNotificationData(), NULL))); |
| 459 gfx::Image() /* icon */, | 435 message_center()->AddNotification(scoped_ptr<Notification>( |
| 460 base::string16() /* display_source */, | 436 new Notification(NOTIFICATION_TYPE_SIMPLE, "id2", UTF8ToUTF16("title"), |
| 461 notifier_id1, | 437 UTF8ToUTF16("message"), gfx::Image() /* icon */, |
| 462 RichNotificationData(), | 438 base::string16() /* display_source */, GURL(), |
| 463 NULL))); | 439 notifier_id2, RichNotificationData(), NULL))); |
| 464 message_center()->AddNotification(scoped_ptr<Notification>(new Notification( | |
| 465 NOTIFICATION_TYPE_SIMPLE, | |
| 466 "id2", | |
| 467 UTF8ToUTF16("title"), | |
| 468 UTF8ToUTF16("message"), | |
| 469 gfx::Image() /* icon */, | |
| 470 base::string16() /* display_source */, | |
| 471 notifier_id2, | |
| 472 RichNotificationData(), | |
| 473 NULL))); | |
| 474 | 440 |
| 475 // "id1" is closed but "id2" is still visible as a popup. | 441 // "id1" is closed but "id2" is still visible as a popup. |
| 476 blocker.SetNotificationsEnabled(false); | 442 blocker.SetNotificationsEnabled(false); |
| 477 NotificationList::PopupNotifications popups = | 443 NotificationList::PopupNotifications popups = |
| 478 message_center()->GetPopupNotifications(); | 444 message_center()->GetPopupNotifications(); |
| 479 EXPECT_EQ(1u, popups.size()); | 445 EXPECT_EQ(1u, popups.size()); |
| 480 EXPECT_TRUE(PopupNotificationsContain(popups, "id2")); | 446 EXPECT_TRUE(PopupNotificationsContain(popups, "id2")); |
| 481 EXPECT_EQ(2u, message_center()->GetVisibleNotifications().size()); | 447 EXPECT_EQ(2u, message_center()->GetVisibleNotifications().size()); |
| 482 | 448 |
| 483 message_center()->AddNotification(scoped_ptr<Notification>(new Notification( | 449 message_center()->AddNotification(scoped_ptr<Notification>( |
| 484 NOTIFICATION_TYPE_SIMPLE, | 450 new Notification(NOTIFICATION_TYPE_SIMPLE, "id3", UTF8ToUTF16("title"), |
| 485 "id3", | 451 UTF8ToUTF16("message"), gfx::Image() /* icon */, |
| 486 UTF8ToUTF16("title"), | 452 base::string16() /* display_source */, GURL(), |
| 487 UTF8ToUTF16("message"), | 453 notifier_id1, RichNotificationData(), NULL))); |
| 488 gfx::Image() /* icon */, | 454 message_center()->AddNotification(scoped_ptr<Notification>( |
| 489 base::string16() /* display_source */, | 455 new Notification(NOTIFICATION_TYPE_SIMPLE, "id4", UTF8ToUTF16("title"), |
| 490 notifier_id1, | 456 UTF8ToUTF16("message"), gfx::Image() /* icon */, |
| 491 RichNotificationData(), | 457 base::string16() /* display_source */, GURL(), |
| 492 NULL))); | 458 notifier_id2, RichNotificationData(), NULL))); |
| 493 message_center()->AddNotification(scoped_ptr<Notification>(new Notification( | |
| 494 NOTIFICATION_TYPE_SIMPLE, | |
| 495 "id4", | |
| 496 UTF8ToUTF16("title"), | |
| 497 UTF8ToUTF16("message"), | |
| 498 gfx::Image() /* icon */, | |
| 499 base::string16() /* display_source */, | |
| 500 notifier_id2, | |
| 501 RichNotificationData(), | |
| 502 NULL))); | |
| 503 popups = message_center()->GetPopupNotifications(); | 459 popups = message_center()->GetPopupNotifications(); |
| 504 EXPECT_EQ(2u, popups.size()); | 460 EXPECT_EQ(2u, popups.size()); |
| 505 EXPECT_TRUE(PopupNotificationsContain(popups, "id2")); | 461 EXPECT_TRUE(PopupNotificationsContain(popups, "id2")); |
| 506 EXPECT_TRUE(PopupNotificationsContain(popups, "id4")); | 462 EXPECT_TRUE(PopupNotificationsContain(popups, "id4")); |
| 507 EXPECT_EQ(4u, message_center()->GetVisibleNotifications().size()); | 463 EXPECT_EQ(4u, message_center()->GetVisibleNotifications().size()); |
| 508 | 464 |
| 509 blocker.SetNotificationsEnabled(true); | 465 blocker.SetNotificationsEnabled(true); |
| 510 popups = message_center()->GetPopupNotifications(); | 466 popups = message_center()->GetPopupNotifications(); |
| 511 EXPECT_EQ(3u, popups.size()); | 467 EXPECT_EQ(3u, popups.size()); |
| 512 EXPECT_TRUE(PopupNotificationsContain(popups, "id2")); | 468 EXPECT_TRUE(PopupNotificationsContain(popups, "id2")); |
| 513 EXPECT_TRUE(PopupNotificationsContain(popups, "id3")); | 469 EXPECT_TRUE(PopupNotificationsContain(popups, "id3")); |
| 514 EXPECT_TRUE(PopupNotificationsContain(popups, "id4")); | 470 EXPECT_TRUE(PopupNotificationsContain(popups, "id4")); |
| 515 EXPECT_EQ(4u, message_center()->GetVisibleNotifications().size()); | 471 EXPECT_EQ(4u, message_center()->GetVisibleNotifications().size()); |
| 516 } | 472 } |
| 517 | 473 |
| 518 // TotalNotificationBlocker suppresses showing notifications even from the list. | 474 // TotalNotificationBlocker suppresses showing notifications even from the list. |
| 519 // This would provide the feature to 'separated' message centers per-profile for | 475 // This would provide the feature to 'separated' message centers per-profile for |
| 520 // ChromeOS multi-login. | 476 // ChromeOS multi-login. |
| 521 TEST_F(MessageCenterImplTest, TotalNotificationBlocker) { | 477 TEST_F(MessageCenterImplTest, TotalNotificationBlocker) { |
| 522 NotifierId notifier_id1(NotifierId::APPLICATION, "app1"); | 478 NotifierId notifier_id1(NotifierId::APPLICATION, "app1"); |
| 523 NotifierId notifier_id2(NotifierId::APPLICATION, "app2"); | 479 NotifierId notifier_id2(NotifierId::APPLICATION, "app2"); |
| 524 TotalNotificationBlocker blocker(message_center(), notifier_id2); | 480 TotalNotificationBlocker blocker(message_center(), notifier_id2); |
| 525 | 481 |
| 526 message_center()->AddNotification(scoped_ptr<Notification>(new Notification( | 482 message_center()->AddNotification(scoped_ptr<Notification>( |
| 527 NOTIFICATION_TYPE_SIMPLE, | 483 new Notification(NOTIFICATION_TYPE_SIMPLE, "id1", UTF8ToUTF16("title"), |
| 528 "id1", | 484 UTF8ToUTF16("message"), gfx::Image() /* icon */, |
| 529 UTF8ToUTF16("title"), | 485 base::string16() /* display_source */, GURL(), |
| 530 UTF8ToUTF16("message"), | 486 notifier_id1, RichNotificationData(), NULL))); |
| 531 gfx::Image() /* icon */, | 487 message_center()->AddNotification(scoped_ptr<Notification>( |
| 532 base::string16() /* display_source */, | 488 new Notification(NOTIFICATION_TYPE_SIMPLE, "id2", UTF8ToUTF16("title"), |
| 533 notifier_id1, | 489 UTF8ToUTF16("message"), gfx::Image() /* icon */, |
| 534 RichNotificationData(), | 490 base::string16() /* display_source */, GURL(), |
| 535 NULL))); | 491 notifier_id2, RichNotificationData(), NULL))); |
| 536 message_center()->AddNotification(scoped_ptr<Notification>(new Notification( | |
| 537 NOTIFICATION_TYPE_SIMPLE, | |
| 538 "id2", | |
| 539 UTF8ToUTF16("title"), | |
| 540 UTF8ToUTF16("message"), | |
| 541 gfx::Image() /* icon */, | |
| 542 base::string16() /* display_source */, | |
| 543 notifier_id2, | |
| 544 RichNotificationData(), | |
| 545 NULL))); | |
| 546 | 492 |
| 547 // "id1" becomes invisible while "id2" is still visible. | 493 // "id1" becomes invisible while "id2" is still visible. |
| 548 blocker.SetNotificationsEnabled(false); | 494 blocker.SetNotificationsEnabled(false); |
| 549 EXPECT_EQ(1u, message_center()->NotificationCount()); | 495 EXPECT_EQ(1u, message_center()->NotificationCount()); |
| 550 NotificationList::Notifications notifications = | 496 NotificationList::Notifications notifications = |
| 551 message_center()->GetVisibleNotifications(); | 497 message_center()->GetVisibleNotifications(); |
| 552 EXPECT_FALSE(NotificationsContain(notifications, "id1")); | 498 EXPECT_FALSE(NotificationsContain(notifications, "id1")); |
| 553 EXPECT_TRUE(NotificationsContain(notifications, "id2")); | 499 EXPECT_TRUE(NotificationsContain(notifications, "id2")); |
| 554 | 500 |
| 555 message_center()->AddNotification(scoped_ptr<Notification>(new Notification( | 501 message_center()->AddNotification(scoped_ptr<Notification>( |
| 556 NOTIFICATION_TYPE_SIMPLE, | 502 new Notification(NOTIFICATION_TYPE_SIMPLE, "id3", UTF8ToUTF16("title"), |
| 557 "id3", | 503 UTF8ToUTF16("message"), gfx::Image() /* icon */, |
| 558 UTF8ToUTF16("title"), | 504 base::string16() /* display_source */, GURL(), |
| 559 UTF8ToUTF16("message"), | 505 notifier_id1, RichNotificationData(), NULL))); |
| 560 gfx::Image() /* icon */, | 506 message_center()->AddNotification(scoped_ptr<Notification>( |
| 561 base::string16() /* display_source */, | 507 new Notification(NOTIFICATION_TYPE_SIMPLE, "id4", UTF8ToUTF16("title"), |
| 562 notifier_id1, | 508 UTF8ToUTF16("message"), gfx::Image() /* icon */, |
| 563 RichNotificationData(), | 509 base::string16() /* display_source */, GURL(), |
| 564 NULL))); | 510 notifier_id2, RichNotificationData(), NULL))); |
| 565 message_center()->AddNotification(scoped_ptr<Notification>(new Notification( | |
| 566 NOTIFICATION_TYPE_SIMPLE, | |
| 567 "id4", | |
| 568 UTF8ToUTF16("title"), | |
| 569 UTF8ToUTF16("message"), | |
| 570 gfx::Image() /* icon */, | |
| 571 base::string16() /* display_source */, | |
| 572 notifier_id2, | |
| 573 RichNotificationData(), | |
| 574 NULL))); | |
| 575 EXPECT_EQ(2u, message_center()->NotificationCount()); | 511 EXPECT_EQ(2u, message_center()->NotificationCount()); |
| 576 notifications = message_center()->GetVisibleNotifications(); | 512 notifications = message_center()->GetVisibleNotifications(); |
| 577 EXPECT_FALSE(NotificationsContain(notifications, "id1")); | 513 EXPECT_FALSE(NotificationsContain(notifications, "id1")); |
| 578 EXPECT_TRUE(NotificationsContain(notifications, "id2")); | 514 EXPECT_TRUE(NotificationsContain(notifications, "id2")); |
| 579 EXPECT_FALSE(NotificationsContain(notifications, "id3")); | 515 EXPECT_FALSE(NotificationsContain(notifications, "id3")); |
| 580 EXPECT_TRUE(NotificationsContain(notifications, "id4")); | 516 EXPECT_TRUE(NotificationsContain(notifications, "id4")); |
| 581 | 517 |
| 582 blocker.SetNotificationsEnabled(true); | 518 blocker.SetNotificationsEnabled(true); |
| 583 EXPECT_EQ(4u, message_center()->NotificationCount()); | 519 EXPECT_EQ(4u, message_center()->NotificationCount()); |
| 584 notifications = message_center()->GetVisibleNotifications(); | 520 notifications = message_center()->GetVisibleNotifications(); |
| (...skipping 429 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1014 ASSERT_EQ(3u, message_center()->NotificationCount()); | 950 ASSERT_EQ(3u, message_center()->NotificationCount()); |
| 1015 | 951 |
| 1016 // Now we remove the remaining notifications. | 952 // Now we remove the remaining notifications. |
| 1017 notifier_settings_observer()->NotifierEnabledChanged( | 953 notifier_settings_observer()->NotifierEnabledChanged( |
| 1018 NotifierId(NotifierId::APPLICATION, "app1"), false); | 954 NotifierId(NotifierId::APPLICATION, "app1"), false); |
| 1019 ASSERT_EQ(0u, message_center()->NotificationCount()); | 955 ASSERT_EQ(0u, message_center()->NotificationCount()); |
| 1020 } | 956 } |
| 1021 | 957 |
| 1022 } // namespace internal | 958 } // namespace internal |
| 1023 } // namespace message_center | 959 } // namespace message_center |
| OLD | NEW |