Commit 12cee505 authored by Chris Lu's avatar Chris Lu Committed by Commit Bot

[ios] Add BadgeMediator test

This test ensures that disconnecting the BadgeMediator means that it
stops receiving and handling signals from the BadgeTabHelper.

Bug: 1067429
Change-Id: I259d75eee646ed7b2923a35f5e93e5cd409d52f0
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2134910Reviewed-by: default avatarSergio Collazos <sczs@chromium.org>
Commit-Queue: Chris Lu <thegreenfrog@chromium.org>
Cr-Commit-Position: refs/heads/master@{#756707}
parent 529de5e1
......@@ -247,6 +247,19 @@ TEST_P(BadgeMediatorTest,
EXPECT_FALSE(badge_consumer_.displayedBadge);
}
// Test that the BadgeMediator does not inform its consumer of a new infobar it
// has already been disconnected.
TEST_P(BadgeMediatorTest, BadgeMediatorTestDoNotAddInfobarIfWebStateListGone) {
InsertActivatedWebState(/*index=*/0);
ASSERT_FALSE(badge_consumer_.displayedBadge);
[badge_mediator_ disconnect];
std::unique_ptr<InfoBarIOS> added_infobar = FakeInfobarIOS::Create(
kSecondInfobarType, /*has_badge=*/true, kSecondInfobarMessageText);
InfoBarManagerImpl::FromWebState(web_state_list_.GetActiveWebState())
->AddInfoBar(std::move(added_infobar));
EXPECT_FALSE(badge_consumer_.displayedBadge);
}
// Test that the BadgeMediator updates the badge when it is accepted.
TEST_P(BadgeMediatorTest, BadgeMediatorTestAcceptedBadge) {
InsertActivatedWebState(/*index=*/0);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment