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

Commit 891f605

Browse files
author
Emmanuel Garcia
committed
Fix test
1 parent 557f3e6 commit 891f605

1 file changed

Lines changed: 19 additions & 16 deletions

File tree

shell/platform/android/test/io/flutter/plugin/platform/PlatformViewsControllerTest.java

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ public void getPlatformViewById__hybridComposition() {
232232
attach(jni, platformViewsController);
233233

234234
// Simulate create call from the framework.
235-
createPlatformView(jni, platformViewsController, platformViewId, "testType");
235+
createPlatformView(jni, platformViewsController, platformViewId, "testType", /* hybrid=*/ true);
236236

237237
platformViewsController.initializePlatformViewIfNeeded(platformViewId);
238238

@@ -259,7 +259,7 @@ public void createPlatformViewMessage__initializesAndroidView() {
259259
attach(jni, platformViewsController);
260260

261261
// Simulate create call from the framework.
262-
createPlatformView(jni, platformViewsController, platformViewId, "testType");
262+
createPlatformView(jni, platformViewsController, platformViewId, "testType", /* hybrid=*/ true);
263263
verify(viewFactory, times(1)).create(any(), eq(platformViewId), any());
264264
}
265265

@@ -281,7 +281,7 @@ public void createPlatformViewMessage__throwsIfViewIsNull() {
281281
attach(jni, platformViewsController);
282282

283283
// Simulate create call from the framework.
284-
createPlatformView(jni, platformViewsController, platformViewId, "testType");
284+
createPlatformView(jni, platformViewsController, platformViewId, "testType", /* hybrid=*/ true);
285285
assertEquals(ShadowFlutterJNI.getResponses().size(), 1);
286286

287287
assertThrows(
@@ -309,7 +309,8 @@ public void onDetachedFromJNI_clearsPlatformViewContext() {
309309
attach(jni, platformViewsController);
310310

311311
// Simulate create call from the framework.
312-
createPlatformView(jni, platformViewsController, platformViewId, "testType");
312+
createPlatformView(
313+
jni, platformViewsController, platformViewId, "testType", /* hybrid=*/ false);
313314

314315
assertFalse(platformViewsController.contextToPlatformView.isEmpty());
315316
platformViewsController.onDetachedFromJNI();
@@ -334,7 +335,8 @@ public void onPreEngineRestart_clearsPlatformViewContext() {
334335
attach(jni, platformViewsController);
335336

336337
// Simulate create call from the framework.
337-
createPlatformView(jni, platformViewsController, platformViewId, "testType");
338+
createPlatformView(
339+
jni, platformViewsController, platformViewId, "testType", /* hybrid=*/ false);
338340

339341
assertFalse(platformViewsController.contextToPlatformView.isEmpty());
340342
platformViewsController.onDetachedFromJNI();
@@ -361,7 +363,7 @@ public void createPlatformViewMessage__throwsIfViewHasParent() {
361363
attach(jni, platformViewsController);
362364

363365
// Simulate create call from the framework.
364-
createPlatformView(jni, platformViewsController, platformViewId, "testType");
366+
createPlatformView(jni, platformViewsController, platformViewId, "testType", /* hybrid=*/ true);
365367
assertEquals(ShadowFlutterJNI.getResponses().size(), 1);
366368

367369
assertThrows(
@@ -393,7 +395,7 @@ public void disposeAndroidView__hybridComposition() {
393395
attach(jni, platformViewsController);
394396

395397
// Simulate create call from the framework.
396-
createPlatformView(jni, platformViewsController, platformViewId, "testType");
398+
createPlatformView(jni, platformViewsController, platformViewId, "testType", /* hybrid=*/ true);
397399
platformViewsController.initializePlatformViewIfNeeded(platformViewId);
398400

399401
assertNotNull(androidView.getParent());
@@ -404,7 +406,7 @@ public void disposeAndroidView__hybridComposition() {
404406
assertNull(androidView.getParent());
405407

406408
// Simulate create call from the framework.
407-
createPlatformView(jni, platformViewsController, platformViewId, "testType");
409+
createPlatformView(jni, platformViewsController, platformViewId, "testType", /* hybrid=*/ true);
408410
platformViewsController.initializePlatformViewIfNeeded(platformViewId);
409411

410412
assertNotNull(androidView.getParent());
@@ -434,7 +436,7 @@ public void onEndFrame__destroysOverlaySurfaceAfterFrameOnFlutterSurfaceView() {
434436
jni.onFirstFrame();
435437

436438
// Simulate create call from the framework.
437-
createPlatformView(jni, platformViewsController, platformViewId, "testType");
439+
createPlatformView(jni, platformViewsController, platformViewId, "testType", /* hybrid=*/ true);
438440

439441
// Produce a frame that displays a platform view and an overlay surface.
440442
platformViewsController.onBeginFrame();
@@ -497,7 +499,7 @@ public void onEndFrame__removesPlatformView() {
497499
jni.onFirstFrame();
498500

499501
// Simulate create call from the framework.
500-
createPlatformView(jni, platformViewsController, platformViewId, "testType");
502+
createPlatformView(jni, platformViewsController, platformViewId, "testType", /* hybrid=*/ true);
501503

502504
// Simulate first frame from the framework.
503505
jni.onFirstFrame();
@@ -534,7 +536,7 @@ public void onEndFrame__removesPlatformViewParent() {
534536
jni.onFirstFrame();
535537

536538
// Simulate create call from the framework.
537-
createPlatformView(jni, platformViewsController, platformViewId, "testType");
539+
createPlatformView(jni, platformViewsController, platformViewId, "testType", /* hybrid=*/ true);
538540
platformViewsController.initializePlatformViewIfNeeded(platformViewId);
539541
assertEquals(flutterView.getChildCount(), 2);
540542

@@ -570,7 +572,7 @@ public void detach__destroysOverlaySurfaces() {
570572
jni.onFirstFrame();
571573

572574
// Simulate create call from the framework.
573-
createPlatformView(jni, platformViewsController, platformViewId, "testType");
575+
createPlatformView(jni, platformViewsController, platformViewId, "testType", /* hybrid=*/ true);
574576

575577
// Produce a frame that displays a platform view and an overlay surface.
576578
platformViewsController.onBeginFrame();
@@ -703,7 +705,7 @@ public void convertPlatformViewRenderSurfaceAsDefault() {
703705
jni.onFirstFrame();
704706

705707
// Simulate create call from the framework.
706-
createPlatformView(jni, platformViewsController, platformViewId, "testType");
708+
createPlatformView(jni, platformViewsController, platformViewId, "testType", /* hybrid=*/ true);
707709

708710
// Produce a frame that displays a platform view and an overlay surface.
709711
platformViewsController.onBeginFrame();
@@ -752,7 +754,7 @@ public void dontConverRenderSurfaceWhenFlagIsTrue() {
752754
synchronizeToNativeViewHierarchy(jni, platformViewsController, false);
753755

754756
// Simulate create call from the framework.
755-
createPlatformView(jni, platformViewsController, platformViewId, "testType");
757+
createPlatformView(jni, platformViewsController, platformViewId, "testType", /* hybrid=*/ true);
756758

757759
// Produce a frame that displays a platform view and an overlay surface.
758760
platformViewsController.onBeginFrame();
@@ -784,9 +786,10 @@ private static void createPlatformView(
784786
FlutterJNI jni,
785787
PlatformViewsController platformViewsController,
786788
int platformViewId,
787-
String viewType) {
789+
String viewType,
790+
boolean hybrid) {
788791
final Map<String, Object> platformViewCreateArguments = new HashMap<>();
789-
platformViewCreateArguments.put("hybrid", true);
792+
platformViewCreateArguments.put("hybrid", hybrid);
790793
platformViewCreateArguments.put("id", platformViewId);
791794
platformViewCreateArguments.put("viewType", viewType);
792795
platformViewCreateArguments.put("direction", 0);

0 commit comments

Comments
 (0)