Commit 9ad464ef authored by sczs's avatar sczs Committed by Commit Bot

[ios] Adds support for a high priority Infobar presentation.

Some ConfirmInfobars like Restore tabs are important enough that we
don't want some users to miss them. Either because they are not presented
because some other Infobar is being presented, or because they time out
before the user has seen it.

This CL adds a BOOL flag to InfobarCoordinator, which InfobarContainerCoordinator
will use in order to add that Infobar's banner to the top of the queue and display
it for a bit longer.

I didn't want to create a more granular system since this might be temporary until
we migrate some of these Infobars to alerts or something similar, and its also
not currently needed.

Bug: 961343
Change-Id: Icf03748ec50b63bd9c99ead96ccae5c7fc644b0c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1828237Reviewed-by: default avatarPeter Lee <pkl@chromium.org>
Reviewed-by: default avatarChris Lu <thegreenfrog@chromium.org>
Commit-Queue: Sergio Collazos <sczs@chromium.org>
Cr-Commit-Position: refs/heads/master@{#701261}
parent 85a4df5d
......@@ -62,6 +62,7 @@ source_set("crash_report_internal") {
"//ios/chrome/browser/infobars",
"//ios/chrome/browser/sessions",
"//ios/chrome/browser/sessions:serialisation",
"//ios/chrome/browser/ui/infobars:feature_flags",
"//ios/chrome/browser/web:tab_id_tab_helper",
"//ios/chrome/browser/web_state_list",
"//ios/web",
......
......@@ -20,11 +20,13 @@
#include "ios/chrome/browser/browser_state/chrome_browser_state.h"
#import "ios/chrome/browser/crash_report/breakpad_helper.h"
#include "ios/chrome/browser/infobars/infobar_manager_impl.h"
#include "ios/chrome/browser/infobars/infobar_utils.h"
#include "ios/chrome/browser/sessions/ios_chrome_tab_restore_service_factory.h"
#import "ios/chrome/browser/sessions/session_ios.h"
#import "ios/chrome/browser/sessions/session_service_ios.h"
#import "ios/chrome/browser/sessions/session_window_ios.h"
#import "ios/chrome/browser/sessions/session_window_restoring.h"
#import "ios/chrome/browser/ui/infobars/infobar_feature.h"
#include "ios/chrome/browser/web_state_list/web_state_list.h"
#include "ios/chrome/grit/ios_theme_resources.h"
#import "ios/web/public/web_state.h"
......@@ -133,8 +135,14 @@ bool SessionCrashedInfoBarDelegate::Create(
DCHECK(infobar_manager);
std::unique_ptr<ConfirmInfoBarDelegate> delegate(
new SessionCrashedInfoBarDelegate(crash_restore_helper));
return !!infobar_manager->AddInfoBar(
infobar_manager->CreateConfirmInfoBar(std::move(delegate)));
if (IsInfobarUIRebootEnabled()) {
return !!infobar_manager->AddInfoBar(
::CreateHighPriorityConfirmInfoBar(std::move(delegate)));
} else {
return !!infobar_manager->AddInfoBar(
::CreateConfirmInfoBar(std::move(delegate)));
}
}
infobars::InfoBarDelegate::InfoBarIdentifier
......
......@@ -18,4 +18,11 @@ class InfoBar;
std::unique_ptr<infobars::InfoBar> CreateConfirmInfoBar(
std::unique_ptr<ConfirmInfoBarDelegate> delegate);
// Returns a confirm infobar with high priority presentation that owns
// |delegate|.
// TODO (crbug.com/961343):Reassess this method once there's more clarity on how
// to handle queueing and if priorities are actually needed.
std::unique_ptr<infobars::InfoBar> CreateHighPriorityConfirmInfoBar(
std::unique_ptr<ConfirmInfoBarDelegate> delegate);
#endif // IOS_CHROME_BROWSER_INFOBARS_INFOBAR_UTILS_H_
......@@ -37,3 +37,17 @@ std::unique_ptr<infobars::InfoBar> CreateConfirmInfoBar(
return std::make_unique<InfoBarIOS>(controller, std::move(delegate));
}
}
std::unique_ptr<infobars::InfoBar> CreateHighPriorityConfirmInfoBar(
std::unique_ptr<ConfirmInfoBarDelegate> delegate) {
DCHECK(IsInfobarUIRebootEnabled());
// TODO(crbug.com/927064): Coordinators shouldn't be created at this level,
// we should probably send only the delegate and have the presenting
// Coordinator create the right Coordinator using that delegate.
InfobarConfirmCoordinator* coordinator = [[InfobarConfirmCoordinator alloc]
initWithInfoBarDelegate:delegate.get()
badgeSupport:NO
type:InfobarType::kInfobarTypeConfirm];
coordinator.highPriorityPresentation = YES;
return std::make_unique<InfoBarIOS>(coordinator, std::move(delegate));
}
......@@ -116,6 +116,13 @@ enum class InfobarBannerPresentationState;
// YES if the banner has ever been presented for this Coordinator.
@property(nonatomic, assign, readonly) BOOL bannerWasPresented;
// If YES this Coordinator's banner will have a higher presentation priority
// than other InfobarCoordinators with this property set to NO. The parent
// Coordinator will define what this means e.g. Longer presentation time before
// auto-dismiss and/or jumping the queue and being the next banner to present,
// etc.
@property(nonatomic, assign) BOOL highPriorityPresentation;
@end
#endif // IOS_CHROME_BROWSER_UI_INFOBARS_COORDINATORS_INFOBAR_COORDINATOR_H_
......@@ -15,6 +15,9 @@ extern NSString* const kConfirmInfobarButton2AccessibilityIdentifier;
// The duration in seconds that the InfobarCoordinator banner will be presented
// for.
extern const NSTimeInterval kInfobarBannerPresentationDurationInSeconds;
extern const NSTimeInterval kInfobarBannerDefaultPresentationDurationInSeconds;
// The duration in seconds that a high priority presentation InfobarCoordinator
// banner will be presented for.
extern const NSTimeInterval kInfobarBannerLongPresentationDurationInSeconds;
#endif // IOS_CHROME_BROWSER_UI_INFOBARS_INFOBAR_CONSTANTS_H_
......@@ -16,4 +16,5 @@ NSString* const kConfirmInfobarButton1AccessibilityIdentifier =
NSString* const kConfirmInfobarButton2AccessibilityIdentifier =
@"confirmInfobarButton2AXID";
const NSTimeInterval kInfobarBannerPresentationDurationInSeconds = 8.0;
const NSTimeInterval kInfobarBannerDefaultPresentationDurationInSeconds = 8.0;
const NSTimeInterval kInfobarBannerLongPresentationDurationInSeconds = 15.0;
......@@ -287,8 +287,7 @@
if (!(self.infobarBannerState ==
InfobarBannerPresentationState::NotPresented) ||
(!self.baseViewController.view.window)) {
if (![self.infobarCoordinatorsToPresent containsObject:infobarCoordinator])
[self.infobarCoordinatorsToPresent addObject:infobarCoordinator];
[self queueInfobarCoordinatorForPresentation:infobarCoordinator];
return;
}
......@@ -300,9 +299,12 @@
// Dismisses the presented InfobarCoordinator banner after
// kInfobarBannerPresentationDurationInSeconds seconds.
if (!UIAccessibilityIsVoiceOverRunning()) {
dispatch_time_t popTime = dispatch_time(
DISPATCH_TIME_NOW,
kInfobarBannerPresentationDurationInSeconds * NSEC_PER_SEC);
NSTimeInterval timeInterval =
infobarCoordinator.highPriorityPresentation
? kInfobarBannerLongPresentationDurationInSeconds
: kInfobarBannerDefaultPresentationDurationInSeconds;
dispatch_time_t popTime =
dispatch_time(DISPATCH_TIME_NOW, timeInterval * NSEC_PER_SEC);
dispatch_after(popTime, dispatch_get_main_queue(), ^(void) {
[infobarCoordinator dismissInfobarBannerAfterInteraction];
});
......@@ -322,4 +324,17 @@
return nil;
}
// Queues an InfobarBanner for presentation. If it has already been queued it
// won't be added again.
- (void)queueInfobarCoordinatorForPresentation:
(InfobarCoordinator*)coordinator {
if (![self.infobarCoordinatorsToPresent containsObject:coordinator]) {
if (coordinator.highPriorityPresentation) {
[self.infobarCoordinatorsToPresent insertObject:coordinator atIndex:0];
} else {
[self.infobarCoordinatorsToPresent addObject:coordinator];
}
}
}
@end
......@@ -106,16 +106,6 @@ class InfobarContainerCoordinatorTest : public PlatformTest {
YES;
[infobar_container_coordinator_ start];
// Setup the InfobarCoordinator and InfobarDelegate.
TestInfoBarDelegate* test_infobar_delegate =
new TestInfoBarDelegate(@"Title");
coordinator_ = [[InfobarConfirmCoordinator alloc]
initWithInfoBarDelegate:test_infobar_delegate
badgeSupport:YES
type:InfobarType::kInfobarTypeConfirm];
infobar_delegate_ =
std::unique_ptr<ConfirmInfoBarDelegate>(test_infobar_delegate);
// Setup the Legacy InfobarController and InfobarDelegate.
TestInfoBarDelegate* test_legacy_infobar_delegate =
new TestInfoBarDelegate(@"Legacy Infobar");
......@@ -142,14 +132,25 @@ class InfobarContainerCoordinatorTest : public PlatformTest {
// Adds an Infobar to the InfobarManager, triggering an InfobarBanner
// presentation.
void AddInfobar() {
void AddInfobar(bool high_priority_presentation) {
// Setup the InfobarCoordinator and InfobarDelegate.
TestInfoBarDelegate* test_infobar_delegate =
new TestInfoBarDelegate(@"Title");
coordinator_ = [[InfobarConfirmCoordinator alloc]
initWithInfoBarDelegate:test_infobar_delegate
badgeSupport:YES
type:InfobarType::kInfobarTypeConfirm];
coordinator_.highPriorityPresentation = high_priority_presentation;
infobar_delegate_ =
std::unique_ptr<ConfirmInfoBarDelegate>(test_infobar_delegate);
GetInfobarManager()->AddInfoBar(std::make_unique<InfoBarIOS>(
coordinator_, std::move(infobar_delegate_)));
}
// Adds an Infobar to the InfobarManager, triggering an InfobarBanner
// presentation.
void AddSecondInfobar() {
void AddSecondInfobar(bool high_priority_presentation) {
// Setup the InfobarCoordinator and InfobarDelegate.
TestInfoBarDelegate* test_infobar_delegate =
new TestInfoBarDelegate(@"Title 2");
......@@ -157,6 +158,7 @@ class InfobarContainerCoordinatorTest : public PlatformTest {
initWithInfoBarDelegate:test_infobar_delegate
badgeSupport:YES
type:InfobarType::kInfobarTypePasswordSave];
second_coordinator_.highPriorityPresentation = high_priority_presentation;
std::unique_ptr<ConfirmInfoBarDelegate> infobar_delegate =
std::unique_ptr<ConfirmInfoBarDelegate>(test_infobar_delegate);
......@@ -209,7 +211,7 @@ TEST_F(InfobarContainerCoordinatorTest,
InfobarBannerPresentationStatePresented) {
EXPECT_NE(infobar_container_coordinator_.infobarBannerState,
InfobarBannerPresentationState::Presented);
AddInfobar();
AddInfobar(/*high_priority_presentation=*/false);
ASSERT_TRUE(base::test::ios::WaitUntilConditionOrTimeout(
base::test::ios::kWaitForUIElementTimeout, ^bool {
return infobar_container_coordinator_.infobarBannerState ==
......@@ -225,7 +227,7 @@ TEST_F(InfobarContainerCoordinatorTest, TestAutomaticInfobarBannerDismissal) {
EXPECT_NE(infobar_container_coordinator_.infobarBannerState,
InfobarBannerPresentationState::Presented);
AddInfobar();
AddInfobar(/*high_priority_presentation=*/false);
EXPECT_TRUE(base::test::ios::WaitUntilConditionOrTimeout(
base::test::ios::kWaitForUIElementTimeout, ^bool {
......@@ -236,7 +238,7 @@ TEST_F(InfobarContainerCoordinatorTest, TestAutomaticInfobarBannerDismissal) {
ASSERT_EQ(infobar_container_coordinator_.infobarBannerState,
InfobarBannerPresentationState::Presented);
EXPECT_TRUE(base::test::ios::WaitUntilConditionOrTimeout(
kInfobarBannerPresentationDurationInSeconds, ^bool {
kInfobarBannerDefaultPresentationDurationInSeconds, ^bool {
return infobar_container_coordinator_.infobarBannerState ==
InfobarBannerPresentationState::NotPresented;
}));
......@@ -250,7 +252,7 @@ TEST_F(InfobarContainerCoordinatorTest, TestInfobarBannerDismissal) {
EXPECT_FALSE(infobar_container_coordinator_.infobarBannerState ==
InfobarBannerPresentationState::Presented);
AddInfobar();
AddInfobar(/*high_priority_presentation=*/false);
EXPECT_TRUE(base::test::ios::WaitUntilConditionOrTimeout(
base::test::ios::kWaitForUIElementTimeout, ^bool {
......@@ -291,7 +293,7 @@ TEST_F(InfobarContainerCoordinatorTest,
TestInfobarBannerPresentationBeforeLegacyPresentation) {
EXPECT_NE(infobar_container_coordinator_.infobarBannerState,
InfobarBannerPresentationState::Presented);
AddInfobar();
AddInfobar(/*high_priority_presentation=*/false);
ASSERT_TRUE(base::test::ios::WaitUntilConditionOrTimeout(
base::test::ios::kWaitForUIElementTimeout, ^bool {
return infobar_container_coordinator_.infobarBannerState ==
......@@ -315,7 +317,7 @@ TEST_F(InfobarContainerCoordinatorTest,
isInfobarPresentingForWebState:web_state_list_->GetActiveWebState()]);
ASSERT_NE(infobar_container_coordinator_.infobarBannerState,
InfobarBannerPresentationState::Presented);
AddInfobar();
AddInfobar(/*high_priority_presentation=*/false);
ASSERT_TRUE(base::test::ios::WaitUntilConditionOrTimeout(
base::test::ios::kWaitForUIElementTimeout, ^bool {
return infobar_container_coordinator_.infobarBannerState ==
......@@ -328,7 +330,7 @@ TEST_F(InfobarContainerCoordinatorTest,
// Tests that the InfobarBanner is dismissed when changing Webstates.
TEST_F(InfobarContainerCoordinatorTest,
TestInfobarBannerDismissAtWebStateChange) {
AddInfobar();
AddInfobar(/*high_priority_presentation=*/false);
AddSecondWebstate();
EXPECT_TRUE(base::test::ios::WaitUntilConditionOrTimeout(
......@@ -354,7 +356,7 @@ TEST_F(InfobarContainerCoordinatorTest,
// different Webstate.
TEST_F(InfobarContainerCoordinatorTest,
TestInfobarBannerNotPresentAfterWebStateChange) {
AddInfobar();
AddInfobar(/*high_priority_presentation=*/false);
AddSecondWebstate();
EXPECT_TRUE(base::test::ios::WaitUntilConditionOrTimeout(
......@@ -389,7 +391,7 @@ TEST_F(InfobarContainerCoordinatorTest,
// Tests infobarBannerState is NotPresented once an InfobarBanner has been
// dismissed directly by its base VC.
TEST_F(InfobarContainerCoordinatorTest, TestInfobarBannerDismissalByBaseVC) {
AddInfobar();
AddInfobar(/*high_priority_presentation=*/false);
EXPECT_TRUE(base::test::ios::WaitUntilConditionOrTimeout(
base::test::ios::kWaitForUIElementTimeout, ^bool {
return infobar_container_coordinator_.infobarBannerState ==
......@@ -411,7 +413,7 @@ TEST_F(InfobarContainerCoordinatorTest, TestInfobarBannerDismissalByBaseVC) {
// Tests that the Infobar is dismissed before its presentation is completed.
TEST_F(InfobarContainerCoordinatorTest,
TestInfobarBannerDismissalMidPresentation) {
AddInfobar();
AddInfobar(/*high_priority_presentation=*/false);
// Call dismiss without calling WaitUntilConditionOrTimeout before.
[base_view_controller_ dismissViewControllerAnimated:NO completion:nil];
......@@ -428,7 +430,7 @@ TEST_F(InfobarContainerCoordinatorTest,
// presentation is completed.
TEST_F(InfobarContainerCoordinatorTest,
TestInfobarBannerDismissedClosingWebstate) {
AddInfobar();
AddInfobar(/*high_priority_presentation=*/false);
// Close the Webstate without calling WaitUntilConditionOrTimeout.
web_state_list_->CloseWebStateAt(0, 0);
ASSERT_TRUE(base::test::ios::WaitUntilConditionOrTimeout(
......@@ -442,7 +444,7 @@ TEST_F(InfobarContainerCoordinatorTest,
// Tests that the Infobar is dismissed when both the VC and Webstate are closed.
TEST_F(InfobarContainerCoordinatorTest, TestDismissingAndClosingWebstate) {
AddInfobar();
AddInfobar(/*high_priority_presentation=*/false);
ASSERT_TRUE(base::test::ios::WaitUntilConditionOrTimeout(
base::test::ios::kWaitForUIElementTimeout, ^bool {
return infobar_container_coordinator_.infobarBannerState ==
......@@ -467,7 +469,7 @@ TEST_F(InfobarContainerCoordinatorTest, TestDismissingAndClosingWebstate) {
// and there's more than one webstate.
TEST_F(InfobarContainerCoordinatorTest,
TestDismissingAndClosingWebstateSecondWebstate) {
AddInfobar();
AddInfobar(/*high_priority_presentation=*/false);
AddSecondWebstate();
EXPECT_TRUE(base::test::ios::WaitUntilConditionOrTimeout(
base::test::ios::kWaitForUIElementTimeout, ^bool {
......@@ -492,7 +494,7 @@ TEST_F(InfobarContainerCoordinatorTest,
// Tests that the ChildCoordinators are deleted once the Webstate is closed.
TEST_F(InfobarContainerCoordinatorTest,
TestInfobarChildCoordinatorCountWebstate) {
AddInfobar();
AddInfobar(/*high_priority_presentation=*/false);
EXPECT_TRUE(base::test::ios::WaitUntilConditionOrTimeout(
base::test::ios::kWaitForUIElementTimeout, ^bool {
......@@ -515,7 +517,7 @@ TEST_F(InfobarContainerCoordinatorTest,
InfobarBannerPresentationState::NotPresented;
}));
AddSecondInfobar();
AddSecondInfobar(/*high_priority_presentation=*/false);
EXPECT_TRUE(base::test::ios::WaitUntilConditionOrTimeout(
base::test::ios::kWaitForUIElementTimeout, ^bool {
return infobar_container_coordinator_.infobarBannerState ==
......@@ -549,7 +551,7 @@ TEST_F(InfobarContainerCoordinatorTest,
// Tests that the ChildCoordinators are deleted once they stop.
TEST_F(InfobarContainerCoordinatorTest, TestInfobarChildCoordinatorCountStop) {
AddInfobar();
AddInfobar(/*high_priority_presentation=*/false);
EXPECT_TRUE(base::test::ios::WaitUntilConditionOrTimeout(
base::test::ios::kWaitForUIElementTimeout, ^bool {
......@@ -572,7 +574,7 @@ TEST_F(InfobarContainerCoordinatorTest, TestInfobarChildCoordinatorCountStop) {
InfobarBannerPresentationState::NotPresented;
}));
AddSecondInfobar();
AddSecondInfobar(/*high_priority_presentation=*/false);
EXPECT_TRUE(base::test::ios::WaitUntilConditionOrTimeout(
base::test::ios::kWaitForUIElementTimeout, ^bool {
return infobar_container_coordinator_.infobarBannerState ==
......@@ -605,8 +607,8 @@ TEST_F(InfobarContainerCoordinatorTest, TestInfobarChildCoordinatorCountStop) {
// Tests that that a second Infobar (added right after the first one) is
// displayed after the first one has been dismissed.
TEST_F(InfobarContainerCoordinatorTest, TestInfobarQueueAndDisplay) {
AddInfobar();
AddSecondInfobar();
AddInfobar(/*high_priority_presentation=*/false);
AddSecondInfobar(/*high_priority_presentation=*/false);
ASSERT_EQ(NSUInteger(2),
infobar_container_coordinator_.childCoordinators.count);
......@@ -639,12 +641,13 @@ TEST_F(InfobarContainerCoordinatorTest, TestInfobarQueueAndDisplay) {
}
// Tests that Infobars added while the baseVC is not in window will be displayed
// once the baseVC moves to it.
// once the baseVC moves to it. Also tests that a non high-priority Infobar
// added after a high priority one will appear first.
TEST_F(InfobarContainerCoordinatorTest,
TestInfobarQueueAndDisplayWhenAppeared) {
[scoped_key_window_.Get() setRootViewController:nil];
AddInfobar();
AddSecondInfobar();
AddInfobar(/*high_priority_presentation=*/true);
AddSecondInfobar(/*high_priority_presentation=*/false);
ASSERT_EQ(infobar_container_coordinator_.infobarBannerState,
InfobarBannerPresentationState::NotPresented);
......@@ -684,8 +687,8 @@ TEST_F(InfobarContainerCoordinatorTest,
// Tests that that a second Infobar (added right after the first one) is
// not displayed if its destroyed before presentation.
TEST_F(InfobarContainerCoordinatorTest, TestInfobarQueueStoppedNoDisplay) {
AddInfobar();
AddSecondInfobar();
AddInfobar(/*high_priority_presentation=*/false);
AddSecondInfobar(/*high_priority_presentation=*/false);
ASSERT_EQ(NSUInteger(2),
infobar_container_coordinator_.childCoordinators.count);
......@@ -712,5 +715,89 @@ TEST_F(InfobarContainerCoordinatorTest, TestInfobarQueueStoppedNoDisplay) {
infobar_container_coordinator_.childCoordinators.count);
}
// Tests that a High Priority Presentation Infobar added after a non High
// Priority Presentation Infobar is presented first.
TEST_F(InfobarContainerCoordinatorTest, TestInfobarQueuePriority) {
[scoped_key_window_.Get() setRootViewController:nil];
AddInfobar(/*high_priority_presentation=*/false);
AddSecondInfobar(/*high_priority_presentation=*/true);
ASSERT_EQ(infobar_container_coordinator_.infobarBannerState,
InfobarBannerPresentationState::NotPresented);
ASSERT_EQ(NSUInteger(2),
infobar_container_coordinator_.childCoordinators.count);
[scoped_key_window_.Get() setRootViewController:base_view_controller_];
EXPECT_TRUE(base::test::ios::WaitUntilConditionOrTimeout(
base::test::ios::kWaitForUIElementTimeout, ^bool {
return second_coordinator_.infobarBannerState ==
InfobarBannerPresentationState::Presented;
}));
ASSERT_EQ(second_coordinator_.infobarBannerState,
InfobarBannerPresentationState::Presented);
[infobar_container_coordinator_ dismissInfobarBannerAnimated:NO
completion:nil];
ASSERT_TRUE(base::test::ios::WaitUntilConditionOrTimeout(
base::test::ios::kWaitForUIElementTimeout, ^bool {
return second_coordinator_.infobarBannerState ==
InfobarBannerPresentationState::NotPresented;
}));
EXPECT_TRUE(base::test::ios::WaitUntilConditionOrTimeout(
base::test::ios::kWaitForUIElementTimeout, ^bool {
return coordinator_.infobarBannerState ==
InfobarBannerPresentationState::Presented;
}));
ASSERT_EQ(infobar_container_coordinator_.infobarBannerState,
InfobarBannerPresentationState::Presented);
ASSERT_EQ(NSUInteger(2),
infobar_container_coordinator_.childCoordinators.count);
}
// Tests that a High Priority Presentation Infobar added after a High
// Priority Presentation Infobar is presented first.
TEST_F(InfobarContainerCoordinatorTest, TestInfobarQueueHighPriority) {
[scoped_key_window_.Get() setRootViewController:nil];
AddInfobar(/*high_priority_presentation=*/true);
AddSecondInfobar(/*high_priority_presentation=*/true);
ASSERT_EQ(infobar_container_coordinator_.infobarBannerState,
InfobarBannerPresentationState::NotPresented);
ASSERT_EQ(NSUInteger(2),
infobar_container_coordinator_.childCoordinators.count);
[scoped_key_window_.Get() setRootViewController:base_view_controller_];
EXPECT_TRUE(base::test::ios::WaitUntilConditionOrTimeout(
base::test::ios::kWaitForUIElementTimeout, ^bool {
return second_coordinator_.infobarBannerState ==
InfobarBannerPresentationState::Presented;
}));
ASSERT_EQ(second_coordinator_.infobarBannerState,
InfobarBannerPresentationState::Presented);
[infobar_container_coordinator_ dismissInfobarBannerAnimated:NO
completion:nil];
ASSERT_TRUE(base::test::ios::WaitUntilConditionOrTimeout(
base::test::ios::kWaitForUIElementTimeout, ^bool {
return second_coordinator_.infobarBannerState ==
InfobarBannerPresentationState::NotPresented;
}));
EXPECT_TRUE(base::test::ios::WaitUntilConditionOrTimeout(
base::test::ios::kWaitForUIElementTimeout, ^bool {
return coordinator_.infobarBannerState ==
InfobarBannerPresentationState::Presented;
}));
ASSERT_EQ(infobar_container_coordinator_.infobarBannerState,
InfobarBannerPresentationState::Presented);
ASSERT_EQ(NSUInteger(2),
infobar_container_coordinator_.childCoordinators.count);
}
// TODO(crbug.com/961343): Add tests that use a BadgedInfobar, in order to do
// this a new TestInfoBarDelegate needs to be created.
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