1package io.flutter.embedding.engine.systemchannels;
3import static io.flutter.Build.API_LEVELS;
4import static org.junit.Assert.assertEquals;
5import static org.mockito.Mockito.any;
6import static org.mockito.Mockito.eq;
7import static org.mockito.Mockito.mock;
8import static org.mockito.Mockito.times;
9import static org.mockito.Mockito.verify;
10import static org.mockito.Mockito.verifyNoInteractions;
12import android.annotation.TargetApi;
13import androidx.test.ext.junit.runners.AndroidJUnit4;
14import io.flutter.plugin.common.MethodCall;
15import io.flutter.plugin.common.MethodChannel;
16import java.util.HashMap;
18import org.json.JSONException;
20import org.junit.runner.RunWith;
21import org.mockito.ArgumentCaptor;
22import org.robolectric.annotation.Config;
27@RunWith(AndroidJUnit4.class)
28@TargetApi(API_LEVELS.API_24)
32 throws JSONException {
37 verify(rawChannel,
times(0)).invokeMethod(
any(),
any());
42 byte[]
data =
"Any String you want".getBytes();
49 verify(rawChannel).setMethodCallHandler(argumentCaptor.capture());
53 verifyNoInteractions(
result);
56 verify(rawChannel,
times(0)).invokeMethod(
any(),
any());
57 Map<String, Object> expected =
new HashMap<>();
58 expected.put(
"enabled",
true);
59 expected.put(
"data",
data);
60 verify(
result).success(expected);
64 argumentCaptor.getValue().onMethodCall(
new MethodCall(
"get",
null), result2);
65 verify(result2).success(expected);
70 byte[]
data =
"Any String you want".getBytes();
77 verify(rawChannel).setMethodCallHandler(argumentCaptor.capture());
81 Map<String, Object> expected =
new HashMap<>();
82 expected.put(
"enabled",
true);
83 expected.put(
"data",
null);
84 verify(
result).success(expected);
91 Map<String, Object> expected2 =
new HashMap<>();
92 expected2.put(
"enabled",
true);
93 expected2.put(
"data",
data);
94 verify(rawChannel).invokeMethod(
eq(
"push"),
eq(expected2), resultCapture.capture());
95 resultCapture.getValue().success(
null);
101 byte[]
data =
"Any String you want".getBytes();
108 verify(rawChannel).setMethodCallHandler(argumentCaptor.capture());
static SkISize times(const SkISize &size, float factor)
static bool eq(const SkM44 &a, const SkM44 &b, float tol)
void itDoesNotDoAnythingWhenRestorationDataIsSetBeforeFrameworkAsks()
void itSendsDataOverWhenRequestIsPending()
void itHoldsOnToDataFromFramework()
byte[] getRestorationData()
void setRestorationData(@NonNull byte[] data)
SIT bool any(const Vec< 1, T > &x)
std::shared_ptr< const fml::Mapping > data