Commit 4709e69c authored by Chris Lu's avatar Chris Lu Committed by Commit Bot

[ios] Do not call set_accept() for Confirm Infobars

Confirm Infobars do not have badges, so there is not need to update
the state of the Infobar. Moreover, after
ConfirmInfobarDelegate::Accept() the tab, and therefore the infobar,
is removed.

Bug: 1129762
Change-Id: I79d9c636b1df3e9de19c3f24f20193e9d0c2df88
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2432584
Commit-Queue: Chris Lu <thegreenfrog@chromium.org>
Reviewed-by: default avatarSergio Collazos <sczs@chromium.org>
Cr-Commit-Position: refs/heads/master@{#811300}
parent 4f50dcad
...@@ -26,7 +26,8 @@ ConfirmInfobarBannerInteractionHandler:: ...@@ -26,7 +26,8 @@ ConfirmInfobarBannerInteractionHandler::
void ConfirmInfobarBannerInteractionHandler::MainButtonTapped( void ConfirmInfobarBannerInteractionHandler::MainButtonTapped(
InfoBarIOS* infobar) { InfoBarIOS* infobar) {
infobar->set_accepted(GetInfobarDelegate(infobar)->Accept()); // Confirm Infobars don't need to update badge status.
GetInfobarDelegate(infobar)->Accept();
} }
void ConfirmInfobarBannerInteractionHandler::BannerVisibilityChanged( void ConfirmInfobarBannerInteractionHandler::BannerVisibilityChanged(
......
...@@ -52,13 +52,10 @@ class ConfirmInfobarBannerInteractionHandlerTest : public PlatformTest { ...@@ -52,13 +52,10 @@ class ConfirmInfobarBannerInteractionHandlerTest : public PlatformTest {
InfoBarIOS* infobar_; InfoBarIOS* infobar_;
}; };
// Tests MainButtonTapped() calls Accept() on the mock delegate and resets // Tests MainButtonTapped() calls Accept() on the mock delegate.
// the infobar to be accepted.
TEST_F(ConfirmInfobarBannerInteractionHandlerTest, MainButton) { TEST_F(ConfirmInfobarBannerInteractionHandlerTest, MainButton) {
ASSERT_FALSE(infobar_->accepted());
EXPECT_CALL(mock_delegate(), Accept()).WillOnce(testing::Return(true)); EXPECT_CALL(mock_delegate(), Accept()).WillOnce(testing::Return(true));
handler_.MainButtonTapped(infobar_); handler_.MainButtonTapped(infobar_);
EXPECT_TRUE(infobar_->accepted());
} }
// Tests that BannerVisibilityChanged() InfobarDismissed() on the mock delegate. // Tests that BannerVisibilityChanged() InfobarDismissed() on the mock delegate.
......
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