@@ -378,31 +378,21 @@ public void itDoesNotAttachFlutterToTheActivityIfNotDesired() {
378
378
// Declare that the host does NOT want Flutter to attach to the surrounding Activity.
379
379
when (mockHost .shouldAttachEngineToActivity ()).thenReturn (false );
380
380
381
- // getActivity() returns null if the activity is not attached
382
- when (mockHost .getActivity ()).thenReturn (null );
383
-
384
381
// Create the real object that we're testing.
385
382
FlutterActivityAndFragmentDelegate delegate = new FlutterActivityAndFragmentDelegate (mockHost );
386
383
387
384
// --- Execute the behavior under test ---
388
385
// Flutter is attached to the surrounding Activity in onAttach.
389
386
delegate .onAttach (RuntimeEnvironment .application );
390
387
391
- // Make sure all of the other lifecycle methods can run safely as well
392
- // without a valid Activity
393
- delegate .onCreateView (null , null , null );
394
- delegate .onStart ();
395
- delegate .onResume ();
396
- delegate .onPause ();
397
- delegate .onStop ();
398
- delegate .onDestroyView ();
388
+ // Verify that the ActivityControlSurface was NOT told to attach to an Activity.
389
+ verify (mockFlutterEngine .getActivityControlSurface (), never ())
390
+ .attachToActivity (any (Activity .class ), any (Lifecycle .class ));
399
391
400
392
// Flutter is detached from the surrounding Activity in onDetach.
401
393
delegate .onDetach ();
402
394
403
- // Verify that the ActivityControlSurface was NOT told to attach or detach to an Activity.
404
- verify (mockFlutterEngine .getActivityControlSurface (), never ())
405
- .attachToActivity (any (Activity .class ), any (Lifecycle .class ));
395
+ // Verify that the ActivityControlSurface was NOT told to detach from the Activity.
406
396
verify (mockFlutterEngine .getActivityControlSurface (), never ()).detachFromActivity ();
407
397
}
408
398
0 commit comments