| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #import "ios/clean/chrome/browser/browser_coordinator+internal.h" | 5 #import "ios/clean/chrome/browser/browser_coordinator+internal.h" |
| 6 #import "ios/clean/chrome/browser/browser_coordinator.h" | 6 #import "ios/clean/chrome/browser/browser_coordinator.h" |
| 7 | 7 |
| 8 #import "ios/shared/chrome/browser/coordinator_context/coordinator_context.h" | 8 #import "ios/shared/chrome/browser/coordinator_context/coordinator_context.h" |
| 9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
| 10 #include "testing/gtest_mac.h" | 10 #include "testing/gtest_mac.h" |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 @implementation NonOverlayableCoordinator | 43 @implementation NonOverlayableCoordinator |
| 44 | 44 |
| 45 - (BOOL)canAddOverlayCoordinator:(BrowserCoordinator*)overlayCoordinator { | 45 - (BOOL)canAddOverlayCoordinator:(BrowserCoordinator*)overlayCoordinator { |
| 46 return NO; | 46 return NO; |
| 47 } | 47 } |
| 48 | 48 |
| 49 @end | 49 @end |
| 50 | 50 |
| 51 namespace { | 51 namespace { |
| 52 | 52 |
| 53 TEST(BrowserCoordinatorTest, TestStopOnDealloc) { | 53 TEST(BrowserCoordinatorTest, TestDontStopOnDealloc) { |
| 54 __block BOOL called = NO; | 54 __block BOOL called = NO; |
| 55 | 55 |
| 56 { | 56 { |
| 57 TestCoordinator* coordinator = [[TestCoordinator alloc] init]; | 57 TestCoordinator* coordinator = [[TestCoordinator alloc] init]; |
| 58 coordinator.stopHandler = ^{ | 58 coordinator.stopHandler = ^{ |
| 59 called = YES; | 59 called = YES; |
| 60 }; | 60 }; |
| 61 } | 61 } |
| 62 | 62 |
| 63 EXPECT_TRUE(called); | 63 EXPECT_FALSE(called); |
| 64 } | 64 } |
| 65 | 65 |
| 66 TEST(BrowserCoordinatorTest, TestChildren) { | 66 TEST(BrowserCoordinatorTest, TestChildren) { |
| 67 TestCoordinator* parent = [[TestCoordinator alloc] init]; | 67 TestCoordinator* parent = [[TestCoordinator alloc] init]; |
| 68 TestCoordinator* child = [[TestCoordinator alloc] init]; | 68 TestCoordinator* child = [[TestCoordinator alloc] init]; |
| 69 | 69 |
| 70 [parent addChildCoordinator:child]; | 70 [parent addChildCoordinator:child]; |
| 71 EXPECT_TRUE([parent.children containsObject:child]); | 71 EXPECT_TRUE([parent.children containsObject:child]); |
| 72 EXPECT_EQ(parent, child.parentCoordinator); | 72 EXPECT_EQ(parent, child.parentCoordinator); |
| 73 EXPECT_EQ(parent.viewController, child.context.baseViewController); | 73 EXPECT_EQ(parent.viewController, child.context.baseViewController); |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 [[NonOverlayableCoordinator alloc] init]; | 131 [[NonOverlayableCoordinator alloc] init]; |
| 132 TestCoordinator* thirdOverlay = [[TestCoordinator alloc] init]; | 132 TestCoordinator* thirdOverlay = [[TestCoordinator alloc] init]; |
| 133 | 133 |
| 134 EXPECT_FALSE([noOverlays canAddOverlayCoordinator:thirdOverlay]); | 134 EXPECT_FALSE([noOverlays canAddOverlayCoordinator:thirdOverlay]); |
| 135 EXPECT_FALSE(thirdOverlay.overlaying); | 135 EXPECT_FALSE(thirdOverlay.overlaying); |
| 136 [noOverlays addOverlayCoordinator:thirdOverlay]; | 136 [noOverlays addOverlayCoordinator:thirdOverlay]; |
| 137 EXPECT_FALSE(thirdOverlay.overlaying); | 137 EXPECT_FALSE(thirdOverlay.overlaying); |
| 138 } | 138 } |
| 139 | 139 |
| 140 } // namespace | 140 } // namespace |
| OLD | NEW |