@@ -197,109 +197,6 @@ - (void)skip_testDismissedFlutterViewControllerNotRespondingToApplicationLifecyc
197
197
[engine destroyContext ];
198
198
}
199
199
200
- - (void )skip_testVisibleFlutterViewControllerRespondsToApplicationLifecycle {
201
- XCTestExpectation* engineStartedExpectation = [self expectationWithDescription: @" Engine started" ];
202
-
203
- // Let the engine finish booting (at the end of which the channels are properly set-up) before
204
- // moving onto the next step of showing the next view controller.
205
- ScreenBeforeFlutter* rootVC = [[ScreenBeforeFlutter alloc ] initWithEngineRunCompletion: ^void () {
206
- [engineStartedExpectation fulfill ];
207
- }];
208
-
209
- [self waitForExpectationsWithTimeout: 5 handler: nil ];
210
-
211
- UIApplication* application = UIApplication.sharedApplication ;
212
- application.delegate .window .rootViewController = rootVC;
213
- FlutterEngine* engine = rootVC.engine ;
214
-
215
- NSMutableArray * lifecycleExpectations = [NSMutableArray arrayWithCapacity: 10 ];
216
-
217
- // Expected sequence from showing the FlutterViewController is inactive and resumed.
218
- [lifecycleExpectations addObjectsFromArray: [self initialPresentLifecycles ]];
219
-
220
- [engine.lifecycleChannel setMessageHandler: ^(id message, FlutterReply callback) {
221
- if (lifecycleExpectations.count == 0 ) {
222
- XCTFail (@" Unexpected lifecycle transition: %@ " , message);
223
- return ;
224
- }
225
- XCAppLifecycleTestExpectation* nextExpectation = [lifecycleExpectations objectAtIndex: 0 ];
226
- if (![[nextExpectation expectedLifecycle ] isEqualToString: message]) {
227
- XCTFail (@" Expected lifecycle %@ but instead received %@ " , [nextExpectation expectedLifecycle ],
228
- message);
229
- return ;
230
- }
231
-
232
- [nextExpectation fulfill ];
233
- [lifecycleExpectations removeObjectAtIndex: 0 ];
234
- }];
235
-
236
- FlutterViewController* flutterVC;
237
- @autoreleasepool {
238
- XCTestExpectation* vcShown = [self expectationWithDescription: @" present" ];
239
- flutterVC = [rootVC showFlutter: ^{
240
- [vcShown fulfill ];
241
- }];
242
- [self waitForExpectationsWithTimeout: 5.0 handler: nil ];
243
- [self waitForExpectations: lifecycleExpectations timeout: 5 ];
244
-
245
- // Now put the FlutterViewController into background.
246
- [lifecycleExpectations addObjectsFromArray: @[
247
- [[XCAppLifecycleTestExpectation alloc ]
248
- initForLifecycle: @" AppLifecycleState.inactive"
249
- forStep: @" putting FlutterViewController to the background" ],
250
- [[XCAppLifecycleTestExpectation alloc ]
251
- initForLifecycle: @" AppLifecycleState.paused"
252
- forStep: @" putting FlutterViewController to the background" ]
253
- ]];
254
- [[NSNotificationCenter defaultCenter ]
255
- postNotificationName: UIApplicationWillResignActiveNotification
256
- object: nil ];
257
- [[NSNotificationCenter defaultCenter ]
258
- postNotificationName: UIApplicationDidEnterBackgroundNotification
259
- object: nil ];
260
- [self waitForExpectations: lifecycleExpectations timeout: 5 ];
261
-
262
- // Now restore to foreground
263
- [lifecycleExpectations addObjectsFromArray: @[
264
- [[XCAppLifecycleTestExpectation alloc ]
265
- initForLifecycle: @" AppLifecycleState.inactive"
266
- forStep: @" putting FlutterViewController back to foreground" ],
267
- [[XCAppLifecycleTestExpectation alloc ]
268
- initForLifecycle: @" AppLifecycleState.resumed"
269
- forStep: @" putting FlutterViewController back to foreground" ]
270
- ]];
271
- [[NSNotificationCenter defaultCenter ]
272
- postNotificationName: UIApplicationWillEnterForegroundNotification
273
- object: nil ];
274
- [[NSNotificationCenter defaultCenter ]
275
- postNotificationName: UIApplicationDidBecomeActiveNotification
276
- object: nil ];
277
- [self waitForExpectations: lifecycleExpectations timeout: 5 ];
278
-
279
- // The final dismissal cycles through inactive and paused again.
280
- [lifecycleExpectations addObjectsFromArray: @[
281
- [[XCAppLifecycleTestExpectation alloc ] initForLifecycle: @" AppLifecycleState.inactive"
282
- forStep: @" popping the FlutterViewController" ],
283
- [[XCAppLifecycleTestExpectation alloc ]
284
- initForLifecycle: @" AppLifecycleState.paused"
285
- forStep: @" popping the FlutterViewController" ]
286
- ]];
287
- XCTestExpectation* vcDismissed = [self expectationWithDescription: @" dismiss" ];
288
- [flutterVC dismissViewControllerAnimated: NO
289
- completion: ^{
290
- [vcDismissed fulfill ];
291
- }];
292
- [self waitForExpectationsWithTimeout: 5.0 handler: nil ];
293
- flutterVC = nil ;
294
- [engine setViewController: nil ];
295
- }
296
-
297
- // Dismantle.
298
- [engine.lifecycleChannel setMessageHandler: nil ];
299
- [rootVC dismissViewControllerAnimated: NO completion: nil ];
300
- [engine destroyContext ];
301
- }
302
-
303
200
- (void )skip_testFlutterViewControllerDetachingSendsApplicationLifecycle {
304
201
XCTestExpectation* engineStartedExpectation = [self expectationWithDescription: @" Engine started" ];
305
202
0 commit comments