1package io.flutter.embedding.android;
3import static io.flutter.Build.API_LEVELS;
4import static junit.framework.TestCase.assertEquals;
5import static org.mockito.Mockito.any;
6import static org.mockito.Mockito.doAnswer;
8import android.annotation.TargetApi;
10import androidx.test.ext.junit.runners.AndroidJUnit4;
11import io.flutter.embedding.engine.systemchannels.KeyEventChannel;
12import io.flutter.embedding.engine.systemchannels.KeyEventChannel.EventResponseHandler;
13import io.flutter.embedding.engine.systemchannels.KeyEventChannel.FlutterKeyEvent;
14import org.junit.Before;
16import org.junit.runner.RunWith;
17import org.mockito.Mock;
18import org.mockito.MockitoAnnotations;
19import org.robolectric.annotation.Config;
22@RunWith(AndroidJUnit4.class)
23@TargetApi(API_LEVELS.API_28)
31 MockitoAnnotations.openMocks(
this);
37 final int[] completionCallbackInvocationCounter = {0};
44 .when(keyEventChannel)
48 final KeyEvent keyEvent =
new KeyEvent(KeyEvent.ACTION_DOWN, 65);
52 completionCallbackInvocationCounter[0]++;
54 assertEquals(completionCallbackInvocationCounter[0], 1);
KeyEventChannel keyEventChannel
KeyChannelResponder channelResponder
void primaryResponderTest()
void handleEvent( @NonNull KeyEvent keyEvent, @NonNull OnKeyEventHandledCallback onKeyEventHandledCallback)
SIT bool any(const Vec< 1, T > &x)