1package io.flutter.plugin.common;
3import static org.junit.Assert.assertEquals;
4import static org.junit.Assert.assertNotNull;
5import static org.junit.Assert.assertNull;
6import static org.junit.Assert.assertTrue;
7import static org.junit.Assert.fail;
9import androidx.test.ext.junit.runners.AndroidJUnit4;
10import java.nio.ByteBuffer;
11import java.nio.ByteOrder;
12import java.util.HashMap;
15import org.junit.runner.RunWith;
16import org.robolectric.annotation.Config;
19@RunWith(AndroidJUnit4.class)
24 final Map<String, String>
args =
new HashMap<>();
25 args.put(
"testArg",
"testValue");
32 assertEquals(
call.arguments,
result.arguments);
37 final Map<String, Integer> success =
new HashMap<>();
38 success.put(
"result", 1);
43 assertEquals(success,
result);
51 fail(
"Should have failed to convert unsupported type.");
52 }
catch (IllegalArgumentException
e) {
65 fail(
"Should have thrown a FlutterException since this is an error envelope.");
67 assertEquals(
"code",
result.code);
68 assertEquals(
"error",
result.getMessage());
69 assertNull(
result.details);
75 final Exception
e =
new IllegalArgumentException(
"foo");
82 fail(
"Should have thrown a FlutterException since this is an error envelope.");
84 assertEquals(
"code",
result.code);
85 assertEquals(
"foo",
result.getMessage());
87 String stack = (String)
result.details;
90 "at io.flutter.plugin.common.StandardMethodCodecTest.encodeErrorEnvelopeWithThrowableTest(StandardMethodCodecTest.java:"));
96 final Exception
e =
new IllegalArgumentException(
"foo");
99 "code",
e.getMessage(),
e,
"error stacktrace");
102 buffer.order(ByteOrder.nativeOrder());
108 assertEquals(
"code", (String)
code);
109 assertEquals(
"foo", (String)
message);
110 String stack = (String) details;
113 "at io.flutter.plugin.common.StandardMethodCodecTest.encodeErrorEnvelopeWithStacktraceTest(StandardMethodCodecTest.java:"));
114 assertEquals(
"error stacktrace", (String) stacktrace);
static void fail(const SkString &err)
final Object readValue(@NonNull ByteBuffer buffer)
static final StandardMessageCodec INSTANCE
void encodeSuccessEnvelopeUnsupportedObjectTest()
void encodeSuccessEnvelopeTest()
void encodeErrorEnvelopeWithStacktraceTest()
void encodeErrorEnvelopeWithThrowableTest()
void encodeErrorEnvelopeWithNullDetailsTest()
ByteBuffer encodeSuccessEnvelope(@NonNull Object result)
ByteBuffer encodeErrorEnvelopeWithStacktrace( @NonNull String errorCode, @NonNull String errorMessage, @NonNull Object errorDetails, @NonNull String errorStacktrace)
ByteBuffer encodeErrorEnvelope( @NonNull String errorCode, @NonNull String errorMessage, @NonNull Object errorDetails)
Object decodeEnvelope(@NonNull ByteBuffer envelope)
ByteBuffer encodeMethodCall(@NonNull MethodCall methodCall)
MethodCall decodeMethodCall(@NonNull ByteBuffer methodCall)
static final StandardMethodCodec INSTANCE
FlutterSemanticsFlag flag
G_BEGIN_DECLS G_MODULE_EXPORT FlValue * args
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir Path to the cache directory This is different from the persistent_cache_path in embedder which is used for Skia shader cache icu native lib Path to the library file that exports the ICU data vm service The hostname IP address on which the Dart VM Service should be served If not defaults to or::depending on whether ipv6 is specified vm service A custom Dart VM Service port The default is to pick a randomly available open port disable vm Disable the Dart VM Service The Dart VM Service is never available in release mode disable vm service Disable mDNS Dart VM Service publication Bind to the IPv6 localhost address for the Dart VM Service Ignored if vm service host is set endless trace buffer