21 {
22
23 FlutterJNI flutterJNI = new FlutterJNI();
25
26 AtomicInteger listenerInvocationCount = new AtomicInteger(0);
27 FlutterUiDisplayListener listener =
28 new FlutterUiDisplayListener() {
29 @Override
30 public void onFlutterUiDisplayed() {
31
32
33 flutterRenderer.removeIsDisplayingFlutterUiListener(this);
34
35
36 listenerInvocationCount.incrementAndGet();
37 }
38
39 @Override
40 public void onFlutterUiNoLongerDisplayed() {}
41 };
42 flutterRenderer.addIsDisplayingFlutterUiListener(listener);
43
44
45
46 flutterJNI.onFirstFrame();
47
48
49
50
51 assertEquals(1, listenerInvocationCount.get());
52 }