38 FlutterJNI mockFlutterJNI = mock(FlutterJNI.class);
40 verify(mockFlutterJNI,
times(1)).setRefreshRateFPS(10.0f);
44 ArgumentCaptor<FlutterJNI.AsyncWaitForVsyncDelegate> delegateCaptor =
45 ArgumentCaptor.forClass(FlutterJNI.AsyncWaitForVsyncDelegate.class);
46 verify(mockFlutterJNI,
times(1)).setAsyncWaitForVsyncDelegate(delegateCaptor.capture());
47 delegateCaptor.getValue().asyncWaitForVsync(1);
48 shadowOf(Looper.getMainLooper()).idle();
49 verify(mockFlutterJNI,
times(1)).onVsync(anyLong(),
eq(1000000000l / 10l),
eq(1l));
54 FlutterJNI mockFlutterJNI = mock(FlutterJNI.class);
55 DisplayManager mockDisplayManager = mock(DisplayManager.class);
56 Display mockDisplay = mock(Display.class);
59 when(mockDisplayManager.getDisplay(Display.DEFAULT_DISPLAY)).thenReturn(mockDisplay);
62 verify(mockDisplayManager,
times(1))
63 .registerDisplayListener(displayListenerCaptor.capture(), isNull());
65 when(mockDisplay.getRefreshRate()).thenReturn(90.0f);
66 displayListenerCaptor.getValue().onDisplayChanged(Display.DEFAULT_DISPLAY);
67 verify(mockFlutterJNI,
times(1)).setRefreshRateFPS(90.0f);
71 ArgumentCaptor<FlutterJNI.AsyncWaitForVsyncDelegate> delegateCaptor =
72 ArgumentCaptor.forClass(FlutterJNI.AsyncWaitForVsyncDelegate.class);
73 verify(mockFlutterJNI,
times(1)).setAsyncWaitForVsyncDelegate(delegateCaptor.capture());
74 delegateCaptor.getValue().asyncWaitForVsync(1);
75 shadowOf(Looper.getMainLooper()).idle();
76 verify(mockFlutterJNI,
times(1)).onVsync(anyLong(),
eq(1000000000l / 90l),
eq(1l));
78 when(mockDisplay.getRefreshRate()).thenReturn(60.0f);
79 displayListenerCaptor.getValue().onDisplayChanged(Display.DEFAULT_DISPLAY);
80 verify(mockFlutterJNI,
times(1)).setRefreshRateFPS(60.0f);
82 delegateCaptor.getValue().asyncWaitForVsync(1);
83 shadowOf(Looper.getMainLooper()).idle();
84 verify(mockFlutterJNI,
times(1)).onVsync(anyLong(),
eq(1000000000l / 60l),
eq(1l));
89 FlutterJNI mockFlutterJNI = mock(FlutterJNI.class);
90 DisplayManager mockDisplayManager = mock(DisplayManager.class);
91 Display mockDisplay = mock(Display.class);
92 when(mockDisplayManager.getDisplay(Display.DEFAULT_DISPLAY)).thenReturn(mockDisplay);
93 when(mockDisplay.getRefreshRate()).thenReturn(90.0f);
96 verify(mockDisplayManager,
times(1)).registerDisplayListener(any(), isNull());
98 verify(mockFlutterJNI,
times(1)).setRefreshRateFPS(90.0f);