Commit 7ff34744 authored by sczs's avatar sczs Committed by Commit Bot

[ios] Expands InfobarContainerCoordinator unittests.

- Adds a stop method to InfobarCoordinator that needs to be called by
its subclasses. This nils the animatedFullscreenDisabler_ which prevents
crashes while testing when trying to access it when BrowserState has been
dealloced.

- Adds more test cases to InfobarContainerCoordinatorUnitTests

Bug: 961343
Change-Id: I9957968de7fe4f00f9e951c49bd39d885989ae62
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1703460
Commit-Queue: Sergio Collazos <sczs@chromium.org>
Reviewed-by: default avatarChris Lu <thegreenfrog@chromium.org>
Reviewed-by: default avatarPeter Lee <pkl@chromium.org>
Cr-Commit-Position: refs/heads/master@{#678519}
parent 0e8be617
...@@ -61,6 +61,7 @@ ...@@ -61,6 +61,7 @@
} }
- (void)stop { - (void)stop {
[super stop];
if (self.started) { if (self.started) {
self.started = NO; self.started = NO;
// RemoveInfoBar() will delete the InfobarIOS that owns this Coordinator // RemoveInfoBar() will delete the InfobarIOS that owns this Coordinator
......
...@@ -65,6 +65,9 @@ enum class InfobarBannerPresentationState; ...@@ -65,6 +65,9 @@ enum class InfobarBannerPresentationState;
- (void)dismissInfobarBannerAnimated:(BOOL)animated - (void)dismissInfobarBannerAnimated:(BOOL)animated
completion:(void (^)())completion; completion:(void (^)())completion;
// Stops this Coordinator.
- (void)stop NS_REQUIRES_SUPER;
// YES if the Coordinator has been started. // YES if the Coordinator has been started.
@property(nonatomic, assign) BOOL started; @property(nonatomic, assign) BOOL started;
......
...@@ -81,6 +81,11 @@ const CGFloat kiPadBannerOverlapWithOmnibox = 10.0; ...@@ -81,6 +81,11 @@ const CGFloat kiPadBannerOverlapWithOmnibox = 10.0;
#pragma mark - Public Methods. #pragma mark - Public Methods.
- (void)stop {
animatedFullscreenDisabler_ = nullptr;
_infobarDelegate = nil;
}
- (void)presentInfobarBannerAnimated:(BOOL)animated - (void)presentInfobarBannerAnimated:(BOOL)animated
completion:(ProceduralBlock)completion { completion:(ProceduralBlock)completion {
DCHECK(self.browserState); DCHECK(self.browserState);
......
...@@ -90,6 +90,7 @@ ...@@ -90,6 +90,7 @@
} }
- (void)stop { - (void)stop {
[super stop];
if (self.started) { if (self.started) {
self.started = NO; self.started = NO;
// RemoveInfoBar() will delete the InfobarIOS that owns this Coordinator // RemoveInfoBar() will delete the InfobarIOS that owns this Coordinator
......
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