1package io.flutter.embedding.android;
3import static org.mockito.Mockito.any;
4import static org.mockito.Mockito.mock;
5import static org.mockito.Mockito.times;
6import static org.mockito.Mockito.verify;
8import androidx.test.ext.junit.runners.AndroidJUnit4;
9import io.flutter.embedding.engine.dart.DartExecutor;
10import io.flutter.embedding.engine.systemchannels.KeyboardChannel;
11import io.flutter.plugin.common.BinaryMessenger;
12import io.flutter.plugin.common.MethodCall;
13import io.flutter.plugin.common.MethodChannel;
14import io.flutter.plugin.common.StandardMethodCodec;
15import java.nio.ByteBuffer;
16import java.util.HashMap;
18import org.junit.runner.RunWith;
19import org.mockito.ArgumentCaptor;
20import org.robolectric.annotation.Config;
23@RunWith(AndroidJUnit4.class)
26 private static BinaryMessenger.BinaryReply sendToBinaryMessageHandler(
31 binaryMessageHandler.onMessage((ByteBuffer) encodedMethodCall.flip(), reply);
35 @SuppressWarnings(
"deprecation")
42 KeyboardChannel.KeyboardMethodHandler mockHandler =
46 verify(mockBinaryMessenger,
times(1))
47 .setMessageHandler(
any(String.class), binaryMessageHandlerCaptor.capture());
49 BinaryMessenger.BinaryMessageHandler binaryMessageHandler =
50 binaryMessageHandlerCaptor.getValue();
53 sendToBinaryMessageHandler(binaryMessageHandler,
"getKeyboardState",
null);
55 verify(mockHandler,
times(1)).getKeyboardState();
67 verify(
result).success(
new HashMap());
static SkISize times(const SkISize &size, float factor)
void repliesWhenNoKeyboardChannelHandler()
void respondsToGetKeyboardStateChannelMessage()
final MethodChannel.MethodCallHandler parsingMethodHandler
void setKeyboardMethodHandler(@Nullable KeyboardMethodHandler keyboardMethodHandler)
ByteBuffer encodeMethodCall(@NonNull MethodCall methodCall)
static final StandardMethodCodec INSTANCE
G_BEGIN_DECLS G_MODULE_EXPORT FlValue * args
SIT bool any(const Vec< 1, T > &x)