38 {
39 ArgumentCaptor<BinaryMessenger.BinaryMessageHandler> binaryMessageHandlerCaptor =
40 ArgumentCaptor.forClass(BinaryMessenger.BinaryMessageHandler.class);
41 DartExecutor mockBinaryMessenger = mock(DartExecutor.class);
42 KeyboardChannel.KeyboardMethodHandler mockHandler =
43 mock(KeyboardChannel.KeyboardMethodHandler.class);
44 KeyboardChannel keyboardChannel = new KeyboardChannel(mockBinaryMessenger);
45
46 verify(mockBinaryMessenger,
times(1))
47 .setMessageHandler(
any(String.class), binaryMessageHandlerCaptor.capture());
48
49 BinaryMessenger.BinaryMessageHandler binaryMessageHandler =
50 binaryMessageHandlerCaptor.getValue();
51
52 keyboardChannel.setKeyboardMethodHandler(mockHandler);
53 sendToBinaryMessageHandler(binaryMessageHandler, "getKeyboardState", null);
54
55 verify(mockHandler,
times(1)).getKeyboardState();
56 }
static SkISize times(const SkISize &size, float factor)
SIT bool any(const Vec< 1, T > &x)