OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #import "ios/chrome/browser/ui/elements/activity_overlay_coordinator.h" |
| 6 |
| 7 #include "base/ios/weak_nsobject.h" |
| 8 #include "base/test/ios/wait_util.h" |
| 9 #import "ios/chrome/browser/ui/elements/activity_overlay_view_controller.h" |
| 10 #include "testing/gtest/include/gtest/gtest.h" |
| 11 #import "testing/gtest_mac.h" |
| 12 |
| 13 // Tests that invoking start and stop on the coordinator presents and dismisses |
| 14 // the activity overlay view, respectively. |
| 15 TEST(ActivityOverlayCoordinatorTest, StartAndStop) { |
| 16 base::WeakNSObject<UIView> overlay_view; |
| 17 @autoreleasepool { |
| 18 UIViewController* base_view_controller = |
| 19 [[[UIViewController alloc] init] autorelease]; |
| 20 ActivityOverlayCoordinator* coordinator = |
| 21 [[[ActivityOverlayCoordinator alloc] |
| 22 initWithBaseViewController:base_view_controller] autorelease]; |
| 23 |
| 24 EXPECT_EQ(0u, [base_view_controller.childViewControllers count]); |
| 25 |
| 26 [coordinator start]; |
| 27 EXPECT_EQ(1u, [base_view_controller.childViewControllers count]); |
| 28 overlay_view.reset( |
| 29 [base_view_controller.childViewControllers firstObject].view); |
| 30 EXPECT_TRUE( |
| 31 [[base_view_controller.view subviews] containsObject:overlay_view]); |
| 32 |
| 33 [coordinator stop]; |
| 34 EXPECT_EQ(0u, [base_view_controller.childViewControllers count]); |
| 35 } |
| 36 EXPECT_FALSE(overlay_view.get()); |
| 37 } |
OLD | NEW |