| Index: ios/shared/chrome/browser/ui/coordinators/browser_coordinator_unittest.mm
|
| diff --git a/ios/shared/chrome/browser/ui/coordinators/browser_coordinator_unittest.mm b/ios/shared/chrome/browser/ui/coordinators/browser_coordinator_unittest.mm
|
| index df005e6ebeff8faf3ffec84073390cbc59f37dc6..354f2875d3dee947520074ef8cc80c29ea765853 100644
|
| --- a/ios/shared/chrome/browser/ui/coordinators/browser_coordinator_unittest.mm
|
| +++ b/ios/shared/chrome/browser/ui/coordinators/browser_coordinator_unittest.mm
|
| @@ -190,4 +190,41 @@ TEST(BrowserCoordinatorTest, DidStartWillStop) {
|
| EXPECT_TRUE(parent.childWillStopCalled);
|
| }
|
|
|
| +TEST(BrowserCoordinatorTest, StopStopsStartedChildren) {
|
| + TestCoordinator* parent = [[TestCoordinator alloc] init];
|
| + TestCoordinator* child = [[TestCoordinator alloc] init];
|
| + [parent addChildCoordinator:child];
|
| + [parent start];
|
| + [child start];
|
| + __block BOOL called = NO;
|
| + child.stopHandler = ^{
|
| + called = YES;
|
| + };
|
| + EXPECT_FALSE(called);
|
| +
|
| + // Call stop on the parent.
|
| + [parent stop];
|
| +
|
| + // It should have called stop on the child.
|
| + EXPECT_TRUE(called);
|
| +}
|
| +
|
| +TEST(BrowserCoordinatorTest, StopDoesntStopNonStartedChildren) {
|
| + TestCoordinator* parent = [[TestCoordinator alloc] init];
|
| + TestCoordinator* child = [[TestCoordinator alloc] init];
|
| + [parent addChildCoordinator:child];
|
| + [parent start];
|
| + __block BOOL called = NO;
|
| + child.stopHandler = ^{
|
| + called = YES;
|
| + };
|
| + EXPECT_FALSE(called);
|
| +
|
| + // Call stop on the parent.
|
| + [parent stop];
|
| +
|
| + // It should not have called stop on the child.
|
| + EXPECT_FALSE(called);
|
| +}
|
| +
|
| } // namespace
|
|
|