Commit adf0af4d authored by Mark Cogan's avatar Mark Cogan Committed by Commit Bot

Remove spurious completion from ViewControlllerSwapping

The ViewControllerSwapping method -showTabSwitcher: had a completion parameter that was no longer being used.

Change-Id: Ife1b0609191868d9a3505d8ea0657c54c8ed25dc
Reviewed-on: https://chromium-review.googlesource.com/c/1392341
Commit-Queue: Mark Cogan <marq@chromium.org>
Reviewed-by: default avatarGauthier Ambard <gambard@chromium.org>
Cr-Commit-Position: refs/heads/master@{#619625}
parent d3a58c53
......@@ -1941,7 +1941,7 @@ enum class EnterTabSwitcherSnapshotResult {
_tabSwitcherIsActive = YES;
[_tabSwitcher setDelegate:self];
[self.mainCoordinator showTabSwitcher:_tabSwitcher completion:nil];
[self.mainCoordinator showTabSwitcher:_tabSwitcher];
}
- (BOOL)shouldOpenNTPTabOnActivationOfTabModel:(TabModel*)tabModel {
......
......@@ -23,10 +23,8 @@
@property(nonatomic, readonly, strong) UIViewController* viewController;
// Displays the given TabSwitcher, replacing any TabSwitchers or view
// controllers that may currently be visible. Runs the given |completion| block
// after the view controller is visible.
- (void)showTabSwitcher:(id<TabSwitcher>)tabSwitcher
completion:(ProceduralBlock)completion;
// controllers that may currently be visible.
- (void)showTabSwitcher:(id<TabSwitcher>)tabSwitcher;
// Displays the given view controller, replacing any TabSwitchers or other view
// controllers that may currently be visible. Runs the given |completion| block
......
......@@ -281,8 +281,7 @@
prepareForAppearance];
}
- (void)showTabSwitcher:(id<TabSwitcher>)tabSwitcher
completion:(ProceduralBlock)completion {
- (void)showTabSwitcher:(id<TabSwitcher>)tabSwitcher {
DCHECK(tabSwitcher);
DCHECK_EQ([tabSwitcher viewController], self.baseViewController);
// It's also expected that |tabSwitcher| will be |self.tabSwitcher|, but that
......@@ -295,11 +294,7 @@
self.bvcContainer = nil;
BOOL animated = !self.animationsDisabledForTesting;
[self.baseViewController dismissViewControllerAnimated:animated
completion:completion];
} else {
if (completion) {
completion();
}
completion:nil];
}
// Record when the tab switcher is presented.
// TODO(crbug.com/856965) : Rename metrics.
......
......@@ -103,7 +103,7 @@ TEST_F(TabGridCoordinatorTest, TabViewControllerBeforeTabSwitcher) {
EXPECT_EQ(normal_tab_view_controller_, coordinator_.activeViewController);
// Now setting a TabSwitcher will make the switcher active.
[coordinator_ showTabSwitcher:coordinator_.tabSwitcher completion:nil];
[coordinator_ showTabSwitcher:coordinator_.tabSwitcher];
EXPECT_EQ([coordinator_.tabSwitcher viewController],
coordinator_.activeViewController);
}
......@@ -111,7 +111,7 @@ TEST_F(TabGridCoordinatorTest, TabViewControllerBeforeTabSwitcher) {
// Tests that it is possible to set a TabViewController after setting a
// TabSwitcher.
TEST_F(TabGridCoordinatorTest, TabViewControllerAfterTabSwitcher) {
[coordinator_ showTabSwitcher:coordinator_.tabSwitcher completion:nil];
[coordinator_ showTabSwitcher:coordinator_.tabSwitcher];
EXPECT_EQ([coordinator_.tabSwitcher viewController],
coordinator_.activeViewController);
......@@ -120,7 +120,7 @@ TEST_F(TabGridCoordinatorTest, TabViewControllerAfterTabSwitcher) {
EXPECT_EQ(normal_tab_view_controller_, coordinator_.activeViewController);
// Showing the TabSwitcher again will make it active.
[coordinator_ showTabSwitcher:coordinator_.tabSwitcher completion:nil];
[coordinator_ showTabSwitcher:coordinator_.tabSwitcher];
EXPECT_EQ([coordinator_.tabSwitcher viewController],
coordinator_.activeViewController);
}
......@@ -138,11 +138,11 @@ TEST_F(TabGridCoordinatorTest, SwapTabViewControllers) {
// Tests calling showTabSwitcher twice in a row with the same VC.
TEST_F(TabGridCoordinatorTest, ShowTabSwitcherTwice) {
[coordinator_ showTabSwitcher:coordinator_.tabSwitcher completion:nil];
[coordinator_ showTabSwitcher:coordinator_.tabSwitcher];
EXPECT_EQ([coordinator_.tabSwitcher viewController],
coordinator_.activeViewController);
[coordinator_ showTabSwitcher:coordinator_.tabSwitcher completion:nil];
[coordinator_ showTabSwitcher:coordinator_.tabSwitcher];
EXPECT_EQ([coordinator_.tabSwitcher viewController],
coordinator_.activeViewController);
}
......@@ -161,21 +161,13 @@ TEST_F(TabGridCoordinatorTest, ShowTabViewControllerTwice) {
// Tests that setting the active view controller work and that completion
// handlers are called properly after the new view controller is made active.
TEST_F(TabGridCoordinatorTest, CompletionHandlers) {
// Tests that the completion handler is called when showing the switcher.
__block BOOL completion_handler_was_called = false;
[coordinator_ showTabSwitcher:coordinator_.tabSwitcher
completion:^{
completion_handler_was_called = YES;
}];
base::test::ios::WaitUntilCondition(^bool() {
return completion_handler_was_called;
});
ASSERT_TRUE(completion_handler_was_called);
// Setup: show the switcher.
[coordinator_ showTabSwitcher:coordinator_.tabSwitcher];
// Tests that the completion handler is called when showing a tab view
// controller. Tests that the delegate 'didEnd' method is also called.
delegate_.didEndCalled = NO;
completion_handler_was_called = NO;
__block BOOL completion_handler_was_called = NO;
[coordinator_ showTabViewController:normal_tab_view_controller_
completion:^{
completion_handler_was_called = YES;
......@@ -189,7 +181,6 @@ TEST_F(TabGridCoordinatorTest, CompletionHandlers) {
// Tests that the completion handler is called when replacing an existing tab
// view controller. Tests that the delegate 'didEnd' method is *not* called.
delegate_.didEndCalled = NO;
completion_handler_was_called = NO;
[coordinator_ showTabViewController:incognito_tab_view_controller_
completion:^{
completion_handler_was_called = YES;
......
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