diff --git a/shell/platform/android/io/flutter/embedding/android/FlutterView.java b/shell/platform/android/io/flutter/embedding/android/FlutterView.java index 5d782b678ff6f..31cbeb9673484 100644 --- a/shell/platform/android/io/flutter/embedding/android/FlutterView.java +++ b/shell/platform/android/io/flutter/embedding/android/FlutterView.java @@ -264,7 +264,7 @@ private FlutterView( super(context, attrs); this.flutterTextureView = flutterTextureView; - this.renderSurface = flutterSurfaceView; + this.renderSurface = flutterTextureView; init(); } diff --git a/shell/platform/android/test/io/flutter/FlutterTestSuite.java b/shell/platform/android/test/io/flutter/FlutterTestSuite.java index 480998ac362d4..daf060a2c3b9f 100644 --- a/shell/platform/android/test/io/flutter/FlutterTestSuite.java +++ b/shell/platform/android/test/io/flutter/FlutterTestSuite.java @@ -4,6 +4,7 @@ package io.flutter; +import io.flutter.embedding.android.FlutterActivityAndFragmentDelegateTest; import io.flutter.embedding.android.FlutterActivityTest; import io.flutter.embedding.android.FlutterAndroidComponentTest; import io.flutter.embedding.android.FlutterFragmentTest; @@ -32,8 +33,8 @@ @RunWith(Suite.class) @SuiteClasses({ - // FlutterActivityAndFragmentDelegateTest.class, //TODO(mklim): Fix and re-enable this DartExecutorTest.class, + FlutterActivityAndFragmentDelegateTest.class, FlutterActivityTest.class, FlutterAndroidComponentTest.class, FlutterEngineCacheTest.class, diff --git a/shell/platform/android/test/io/flutter/embedding/android/FlutterActivityAndFragmentDelegateTest.java b/shell/platform/android/test/io/flutter/embedding/android/FlutterActivityAndFragmentDelegateTest.java index 3d8f420795f22..71a946f8a8902 100644 --- a/shell/platform/android/test/io/flutter/embedding/android/FlutterActivityAndFragmentDelegateTest.java +++ b/shell/platform/android/test/io/flutter/embedding/android/FlutterActivityAndFragmentDelegateTest.java @@ -220,7 +220,18 @@ public void itGivesHostAnOpportunityToConfigureFlutterSurfaceView() { public void itGivesHostAnOpportunityToConfigureFlutterTextureView() { // ---- Test setup ---- Host customMockHost = mock(Host.class); + when(customMockHost.getContext()).thenReturn(RuntimeEnvironment.application); + when(customMockHost.getActivity()).thenReturn(Robolectric.setupActivity(Activity.class)); + when(customMockHost.getLifecycle()).thenReturn(mock(Lifecycle.class)); + when(customMockHost.getFlutterShellArgs()).thenReturn(new FlutterShellArgs(new String[] {})); + when(customMockHost.getDartEntrypointFunctionName()).thenReturn("main"); + when(customMockHost.getAppBundlePath()).thenReturn("/fake/path"); + when(customMockHost.getInitialRoute()).thenReturn("/"); when(customMockHost.getRenderMode()).thenReturn(RenderMode.texture); + when(customMockHost.getTransparencyMode()).thenReturn(TransparencyMode.transparent); + when(customMockHost.provideFlutterEngine(any(Context.class))).thenReturn(mockFlutterEngine); + when(customMockHost.shouldAttachEngineToActivity()).thenReturn(true); + when(customMockHost.shouldDestroyEngineWithHost()).thenReturn(true); // Create the real object that we're testing. FlutterActivityAndFragmentDelegate delegate =