#include "flutter/shell/platform/linux/public/flutter_linux/fl_message_codec.h"
#include "gtest/gtest.h"
Go to the source code of this file.
◆ fl_test_codec_class_init()
static void fl_test_codec_class_init |
( |
FlTestCodecClass * |
klass | ) |
|
|
static |
Definition at line 58 of file fl_message_codec_test.cc.
58 {
61}
static FlValue * fl_test_codec_decode_message(FlMessageCodec *codec, GBytes *message, GError **error)
static GBytes * fl_test_codec_encode_message(FlMessageCodec *codec, FlValue *value, GError **error)
◆ fl_test_codec_decode_message()
static FlValue * fl_test_codec_decode_message |
( |
FlMessageCodec * |
codec, |
|
|
GBytes * |
message, |
|
|
GError ** |
error |
|
) |
| |
|
static |
Definition at line 35 of file fl_message_codec_test.cc.
37 {
39
40 size_t data_length;
42 static_cast<const uint8_t*
>(g_bytes_get_data(
message, &data_length));
43 if (data_length < 1) {
47 }
48 if (data_length > 1) {
51 "FL_MESSAGE_CODEC_ERROR_ADDITIONAL_DATA");
53 }
54
56}
@ FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA
@ FL_MESSAGE_CODEC_ERROR_ADDITIONAL_DATA
#define FL_MESSAGE_CODEC_ERROR
const uint8_t uint32_t uint32_t GError ** error
G_MODULE_EXPORT FlValue * fl_value_new_int(int64_t value)
std::shared_ptr< const fml::Mapping > data
#define EXPECT_TRUE(handle)
◆ fl_test_codec_encode_message()
static GBytes * fl_test_codec_encode_message |
( |
FlMessageCodec * |
codec, |
|
|
FlValue * |
value, |
|
|
GError ** |
error |
|
) |
| |
|
static |
Definition at line 19 of file fl_message_codec_test.cc.
21 {
23
26 return g_bytes_new(&c, 1);
27 } else {
29 "ERROR");
30 return nullptr;
31 }
32}
@ FL_MESSAGE_CODEC_ERROR_FAILED
G_MODULE_EXPORT int64_t fl_value_get_int(FlValue *self)
G_MODULE_EXPORT FlValueType fl_value_get_type(FlValue *self)
◆ fl_test_codec_init()
static void fl_test_codec_init |
( |
FlTestCodec * |
self | ) |
|
|
static |
◆ fl_test_codec_new()
static FlTestCodec * fl_test_codec_new |
( |
| ) |
|
|
static |
Definition at line 65 of file fl_message_codec_test.cc.
65 {
66 return FL_TEST_CODEC(g_object_new(fl_test_codec_get_type(), nullptr));
67}
◆ TEST() [1/5]
TEST |
( |
FlMessageCodecTest |
, |
|
|
DecodeMessage |
|
|
) |
| |
Definition at line 107 of file fl_message_codec_test.cc.
107 {
109 uint8_t
data[] = {
'1'};
111
112 g_autoptr(GError)
error =
nullptr;
115 EXPECT_NE(
value,
nullptr);
116 EXPECT_EQ(
error,
nullptr);
117
120}
G_MODULE_EXPORT FlValue * fl_message_codec_decode_message(FlMessageCodec *self, GBytes *message, GError **error)
static FlTestCodec * fl_test_codec_new()
typedefG_BEGIN_DECLS struct _FlValue FlValue
◆ TEST() [2/5]
TEST |
( |
FlMessageCodecTest |
, |
|
|
DecodeMessageEmpty |
|
|
) |
| |
◆ TEST() [3/5]
TEST |
( |
FlMessageCodecTest |
, |
|
|
DecodeMessageExtraData |
|
|
) |
| |
◆ TEST() [4/5]
TEST |
( |
FlMessageCodecTest |
, |
|
|
EncodeMessage |
|
|
) |
| |
Definition at line 69 of file fl_message_codec_test.cc.
69 {
71
73 g_autoptr(GError)
error =
nullptr;
77 EXPECT_EQ(
error,
nullptr);
78 EXPECT_EQ(g_bytes_get_size(
message),
static_cast<gsize
>(1));
79 EXPECT_EQ(
static_cast<const uint8_t*
>(g_bytes_get_data(
message,
nullptr))[0],
80 '1');
81}
G_MODULE_EXPORT GBytes * fl_message_codec_encode_message(FlMessageCodec *self, FlValue *message, GError **error)
◆ TEST() [5/5]
TEST |
( |
FlMessageCodecTest |
, |
|
|
EncodeMessageError |
|
|
) |
| |