Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit 6e77f99

Browse files
committed
Fix unit tests of FlutterEngineGroupComponentTest
1 parent 035d225 commit 6e77f99

File tree

1 file changed

+18
-5
lines changed

1 file changed

+18
-5
lines changed

shell/platform/android/test/io/flutter/embedding/engine/FlutterEngineGroupComponentTest.java

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,11 @@ public void canSpawnMoreEngines() {
121121

122122
doReturn(mock(FlutterEngine.class))
123123
.when(firstEngine)
124-
.spawn(any(Context.class), any(DartEntrypoint.class), nullable(String.class));
124+
.spawn(
125+
any(Context.class),
126+
any(DartEntrypoint.class),
127+
nullable(String.class),
128+
nullable(Object.class));
125129

126130
FlutterEngine secondEngine =
127131
engineGroupUnderTest.createAndRunEngine(
@@ -133,7 +137,11 @@ public void canSpawnMoreEngines() {
133137

134138
// Now the second spawned engine is the only one left and it will be called to spawn the next
135139
// engine in the chain.
136-
when(secondEngine.spawn(any(Context.class), any(DartEntrypoint.class), nullable(String.class)))
140+
when(secondEngine.spawn(
141+
any(Context.class),
142+
any(DartEntrypoint.class),
143+
nullable(String.class),
144+
nullable(Object.class)))
137145
.thenReturn(mock(FlutterEngine.class));
138146

139147
FlutterEngine thirdEngine =
@@ -156,7 +164,8 @@ public void canCreateAndRunCustomEntrypoints() {
156164
eq("some/path/to/flutter_assets"),
157165
eq("other entrypoint"),
158166
isNull(String.class),
159-
any(AssetManager.class));
167+
any(AssetManager.class),
168+
nullable(Object.class));
160169
}
161170

162171
@Test
@@ -176,14 +185,18 @@ public void canCreateAndRunWithCustomInitialRoute() {
176185
doAnswer(invocation -> jniAttached = true).when(secondMockflutterJNI).attachToNative();
177186
doReturn(secondMockflutterJNI)
178187
.when(mockflutterJNI)
179-
.spawn(nullable(String.class), nullable(String.class), nullable(String.class));
188+
.spawn(
189+
nullable(String.class),
190+
nullable(String.class),
191+
nullable(String.class),
192+
nullable(Object.class));
180193

181194
FlutterEngine secondEngine =
182195
engineGroupUnderTest.createAndRunEngine(
183196
RuntimeEnvironment.application, mock(DartEntrypoint.class), "/bar");
184197

185198
assertEquals(2, engineGroupUnderTest.activeEngines.size());
186199
verify(mockflutterJNI, times(1))
187-
.spawn(nullable(String.class), nullable(String.class), eq("/bar"));
200+
.spawn(nullable(String.class), nullable(String.class), eq("/bar"), nullable(Object.class));
188201
}
189202
}

0 commit comments

Comments
 (0)