From 80c04d70c0d60401d0f1a5ebc88b2df61c2df507 Mon Sep 17 00:00:00 2001 From: Zachary Anderson Date: Wed, 27 Apr 2022 16:14:04 -0700 Subject: [PATCH] Delete AppLifecycleTests testDismissedFlutterViewControllerNotRespondingToApplicationLifecycle (#32971) --- .../ScenariosTests/AppLifecycleTests.m | 103 ------------------ 1 file changed, 103 deletions(-) diff --git a/testing/scenario_app/ios/Scenarios/ScenariosTests/AppLifecycleTests.m b/testing/scenario_app/ios/Scenarios/ScenariosTests/AppLifecycleTests.m index d7db8420b00e3..03a636921c810 100644 --- a/testing/scenario_app/ios/Scenarios/ScenariosTests/AppLifecycleTests.m +++ b/testing/scenario_app/ios/Scenarios/ScenariosTests/AppLifecycleTests.m @@ -197,109 +197,6 @@ - (void)skip_testDismissedFlutterViewControllerNotRespondingToApplicationLifecyc [engine destroyContext]; } -- (void)skip_testVisibleFlutterViewControllerRespondsToApplicationLifecycle { - XCTestExpectation* engineStartedExpectation = [self expectationWithDescription:@"Engine started"]; - - // Let the engine finish booting (at the end of which the channels are properly set-up) before - // moving onto the next step of showing the next view controller. - ScreenBeforeFlutter* rootVC = [[ScreenBeforeFlutter alloc] initWithEngineRunCompletion:^void() { - [engineStartedExpectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:5 handler:nil]; - - UIApplication* application = UIApplication.sharedApplication; - application.delegate.window.rootViewController = rootVC; - FlutterEngine* engine = rootVC.engine; - - NSMutableArray* lifecycleExpectations = [NSMutableArray arrayWithCapacity:10]; - - // Expected sequence from showing the FlutterViewController is inactive and resumed. - [lifecycleExpectations addObjectsFromArray:[self initialPresentLifecycles]]; - - [engine.lifecycleChannel setMessageHandler:^(id message, FlutterReply callback) { - if (lifecycleExpectations.count == 0) { - XCTFail(@"Unexpected lifecycle transition: %@", message); - return; - } - XCAppLifecycleTestExpectation* nextExpectation = [lifecycleExpectations objectAtIndex:0]; - if (![[nextExpectation expectedLifecycle] isEqualToString:message]) { - XCTFail(@"Expected lifecycle %@ but instead received %@", [nextExpectation expectedLifecycle], - message); - return; - } - - [nextExpectation fulfill]; - [lifecycleExpectations removeObjectAtIndex:0]; - }]; - - FlutterViewController* flutterVC; - @autoreleasepool { - XCTestExpectation* vcShown = [self expectationWithDescription:@"present"]; - flutterVC = [rootVC showFlutter:^{ - [vcShown fulfill]; - }]; - [self waitForExpectationsWithTimeout:5.0 handler:nil]; - [self waitForExpectations:lifecycleExpectations timeout:5]; - - // Now put the FlutterViewController into background. - [lifecycleExpectations addObjectsFromArray:@[ - [[XCAppLifecycleTestExpectation alloc] - initForLifecycle:@"AppLifecycleState.inactive" - forStep:@"putting FlutterViewController to the background"], - [[XCAppLifecycleTestExpectation alloc] - initForLifecycle:@"AppLifecycleState.paused" - forStep:@"putting FlutterViewController to the background"] - ]]; - [[NSNotificationCenter defaultCenter] - postNotificationName:UIApplicationWillResignActiveNotification - object:nil]; - [[NSNotificationCenter defaultCenter] - postNotificationName:UIApplicationDidEnterBackgroundNotification - object:nil]; - [self waitForExpectations:lifecycleExpectations timeout:5]; - - // Now restore to foreground - [lifecycleExpectations addObjectsFromArray:@[ - [[XCAppLifecycleTestExpectation alloc] - initForLifecycle:@"AppLifecycleState.inactive" - forStep:@"putting FlutterViewController back to foreground"], - [[XCAppLifecycleTestExpectation alloc] - initForLifecycle:@"AppLifecycleState.resumed" - forStep:@"putting FlutterViewController back to foreground"] - ]]; - [[NSNotificationCenter defaultCenter] - postNotificationName:UIApplicationWillEnterForegroundNotification - object:nil]; - [[NSNotificationCenter defaultCenter] - postNotificationName:UIApplicationDidBecomeActiveNotification - object:nil]; - [self waitForExpectations:lifecycleExpectations timeout:5]; - - // The final dismissal cycles through inactive and paused again. - [lifecycleExpectations addObjectsFromArray:@[ - [[XCAppLifecycleTestExpectation alloc] initForLifecycle:@"AppLifecycleState.inactive" - forStep:@"popping the FlutterViewController"], - [[XCAppLifecycleTestExpectation alloc] - initForLifecycle:@"AppLifecycleState.paused" - forStep:@"popping the FlutterViewController"] - ]]; - XCTestExpectation* vcDismissed = [self expectationWithDescription:@"dismiss"]; - [flutterVC dismissViewControllerAnimated:NO - completion:^{ - [vcDismissed fulfill]; - }]; - [self waitForExpectationsWithTimeout:5.0 handler:nil]; - flutterVC = nil; - [engine setViewController:nil]; - } - - // Dismantle. - [engine.lifecycleChannel setMessageHandler:nil]; - [rootVC dismissViewControllerAnimated:NO completion:nil]; - [engine destroyContext]; -} - - (void)skip_testFlutterViewControllerDetachingSendsApplicationLifecycle { XCTestExpectation* engineStartedExpectation = [self expectationWithDescription:@"Engine started"];