Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(29)

Unified Diff: ios/shared/chrome/browser/ui/coordinators/browser_coordinator_unittest.mm

Issue 2812303003: BrowserCoordinator stops its children. (Closed)
Patch Set: Rebased Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ios/shared/chrome/browser/ui/coordinators/browser_coordinator.mm ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « ios/shared/chrome/browser/ui/coordinators/browser_coordinator.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698