| Flutter Linux Embedder |

Functions | Variables
fl_standard_method_codec_test.cc File Reference
`#include "flutter/shell/platform/linux/public/flutter_linux/fl_standard_method_codec.h"`
`#include "flutter/shell/platform/linux/fl_method_codec_private.h"`
`#include "flutter/shell/platform/linux/public/flutter_linux/fl_message_codec.h"`
`#include "flutter/shell/platform/linux/public/flutter_linux/fl_standard_message_codec.h"`
`#include "flutter/shell/platform/linux/testing/fl_test.h"`
`#include "gtest/gtest.h"`

Go to the source code of this file.

## Functions
| G_DECLARE_FINAL_TYPE (FlTestMethodMessageCodec, fl_test_method_message_codec, FL, TEST_METHOD_MESSAGE_CODEC, FlStandardMessageCodec) struct _FlTestMethodMessageCodec
| G_DEFINE_TYPE (FlTestMethodMessageCodec, fl_test_method_message_codec, fl_standard_message_codec_get_type()) static gboolean write_custom_value(FlStandardMessageCodec *codec
| g_byte_array_append (buffer, &type, sizeof(uint8_t))
| fl_standard_message_codec_write_size (codec, buffer, length)
| g_byte_array_append (buffer, reinterpret_cast< const uint8_t * >(text), length)
static gboolean | fl_test_method_message_codec_write_value (FlStandardMessageCodec *codec, GByteArray *buffer, FlValue *value, GError **error)
static FlValue * | read_custom_value (FlStandardMessageCodec *codec, GBytes *buffer, size_t *offset, GError **error)
static FlValue * | fl_test_method_message_codec_read_value_of_type (FlStandardMessageCodec *codec, GBytes *buffer, size_t *offset, int type, GError **error)
static void | fl_test_method_message_codec_class_init (FlTestMethodMessageCodecClass *klass)
static void | fl_test_method_message_codec_init (FlTestMethodMessageCodec *self)
static FlTestMethodMessageCodec * | fl_test_method_message_codec_new ()
static gchar * | encode_method_call (const gchar *name, FlValue *args)
static gchar * | encode_success_envelope (FlValue *result)
static gchar * | encode_error_envelope (const gchar *error_code, const gchar *error_message, FlValue *details)
static void | decode_method_call (const char *hex_string, gchar **name, FlValue **args)
static void | decode_error_method_call (const char *hex_string, GQuark domain, gint code)
static void | decode_response_with_success (const char *hex_string, FlValue *result)
static void | decode_response_with_error (const char *hex_string, const gchar *code, const gchar *error_message, FlValue *details)
static void | decode_error_response (const char *hex_string, GQuark domain, gint code)
| TEST (FlStandardMethodCodecTest, EncodeMethodCallNullptrArgs)
| TEST (FlStandardMethodCodecTest, EncodeMethodCallNullArgs)
| TEST (FlStandardMethodCodecTest, EncodeMethodCallStringArgs)
| TEST (FlStandardMethodCodecTest, EncodeMethodCallListArgs)
| TEST (FlStandardMethodCodecTest, DecodeMethodCallNullArgs)
| TEST (FlStandardMethodCodecTest, DecodeMethodCallStringArgs)
| TEST (FlStandardMethodCodecTest, DecodeMethodCallListArgs)
| TEST (FlStandardMethodCodecTest, DecodeMethodCallNoData)
| TEST (FlStandardMethodCodecTest, DecodeMethodCallNullMethodName)
| TEST (FlStandardMethodCodecTest, DecodeMethodCallMissingArgs)
| TEST (FlStandardMethodCodecTest, EncodeSuccessEnvelopeNullptr)
| TEST (FlStandardMethodCodecTest, EncodeSuccessEnvelopeNull)
| TEST (FlStandardMethodCodecTest, EncodeSuccessEnvelopeString)
| TEST (FlStandardMethodCodecTest, EncodeSuccessEnvelopeList)
| TEST (FlStandardMethodCodecTest, EncodeErrorEnvelopeEmptyCode)
| TEST (FlStandardMethodCodecTest, EncodeErrorEnvelopeNonMessageOrDetails)
| TEST (FlStandardMethodCodecTest, EncodeErrorEnvelopeMessage)
| TEST (FlStandardMethodCodecTest, EncodeErrorEnvelopeDetails)
| TEST (FlStandardMethodCodecTest, EncodeErrorEnvelopeMessageAndDetails)
| TEST (FlStandardMethodCodecTest, DecodeResponseSuccessNull)
| TEST (FlStandardMethodCodecTest, DecodeResponseSuccessString)
| TEST (FlStandardMethodCodecTest, DecodeResponseSuccessList)
| TEST (FlStandardMethodCodecTest, DecodeResponseErrorEmptyCode)
| TEST (FlStandardMethodCodecTest, DecodeResponseErrorNoMessageOrDetails)
| TEST (FlStandardMethodCodecTest, DecodeResponseErrorMessage)
| TEST (FlStandardMethodCodecTest, DecodeResponseErrorDetails)
| TEST (FlStandardMethodCodecTest, DecodeResponseErrorMessageAndDetails)
| TEST (FlStandardMethodCodecTest, DecodeResponseSuccessNoData)
| TEST (FlStandardMethodCodecTest, DecodeResponseSuccessExtraData)
| TEST (FlStandardMethodCodecTest, DecodeResponseErrorNoData)
| TEST (FlStandardMethodCodecTest, DecodeResponseErrorMissingMessageAndDetails)
| TEST (FlStandardMethodCodecTest, DecodeResponseErrorMissingDetails)
| TEST (FlStandardMethodCodecTest, DecodeResponseErrorExtraData)
| TEST (FlStandardMethodCodecTest, DecodeResponseNotImplemented)
| TEST (FlStandardMethodCodecTest, DecodeResponseUnknownEnvelope)
| TEST (FlStandardMethodCodecTest, CustomMessageCodec)

## Variables
GByteArray * | buffer
GByteArray FlValue * | value
GByteArray FlValue GError ** | error
size_t | length = strlen(text)
uint8_t | type = 128
return | TRUE

## Function Documentation

## ◆ decode_error_method_call()

static void decode_error_method_call | ( | const char * | hex_string,
|  | GQuark | domain,
|  | gint | code
| ) |  |
| static

Definition at line 170 of file fl_standard_method_codec_test.cc.

172 {
173 g_autoptr(FlStandardMethodCodec) codec = fl_standard_method_codec_new();
174 g_autoptr(GBytes) message = hex_string_to_bytes(hex_string);
175 g_autoptr(GError) error = nullptr;
176 g_autofree gchar* name = nullptr;
177 g_autoptr(FlValue) args = nullptr;
178 gboolean result = fl_method_codec_decode_method_call(
179 FL_METHOD_CODEC(codec), message, &name, &args, &error);
180 EXPECT_FALSE(result);
181 EXPECT_EQ(name, nullptr);
182 EXPECT_EQ(args, nullptr);
183 EXPECT_TRUE(g_error_matches(error, domain, code));
184 }
message
const char * message
Definition: fl_accessibility_handler.cc:21
g_autoptr
g_autoptr(FlEngine) engine
args
G_BEGIN_DECLS G_MODULE_EXPORT FlValue * args
Definition: fl_event_channel.h:89
fl_method_codec_decode_method_call
gboolean fl_method_codec_decode_method_call(FlMethodCodec *self, GBytes *message, gchar **name, FlValue **args, GError **error)
Definition: fl_method_codec.cc:27
fl_standard_method_codec_new
G_MODULE_EXPORT FlStandardMethodCodec * fl_standard_method_codec_new()
Definition: fl_standard_method_codec.cc:291
error
GByteArray FlValue GError ** error
Definition: fl_standard_method_codec_test.cc:29
FlValue
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:42

References args, error, fl_method_codec_decode_method_call(), fl_standard_method_codec_new(), g_autoptr(), and message.

Referenced by TEST().

## ◆ decode_error_response()

static void decode_error_response | ( | const char * | hex_string,
|  | GQuark | domain,
|  | gint | code
| ) |  |
| static

Definition at line 240 of file fl_standard_method_codec_test.cc.

242 {
243 g_autoptr(FlStandardMethodCodec) codec = fl_standard_method_codec_new();
244 g_autoptr(GBytes) message = hex_string_to_bytes(hex_string);
245 g_autoptr(GError) error = nullptr;
246 g_autoptr(FlMethodResponse) response =
247 fl_method_codec_decode_response(FL_METHOD_CODEC(codec), message, &error);
248 EXPECT_EQ(response, nullptr);
249 EXPECT_TRUE(g_error_matches(error, domain, code));
250 }
fl_method_codec_decode_response
FlMethodResponse * fl_method_codec_decode_response(FlMethodCodec *self, GBytes *message, GError **error)
Definition: fl_method_codec.cc:88

References error, fl_method_codec_decode_response(), fl_standard_method_codec_new(), g_autoptr(), and message.

Referenced by TEST().

## ◆ decode_method_call()

static void decode_method_call | ( | const char * | hex_string,
|  | gchar ** | name,
|  | FlValue ** | args
| ) |  |
| static

Definition at line 157 of file fl_standard_method_codec_test.cc.

159 {
160 g_autoptr(FlStandardMethodCodec) codec = fl_standard_method_codec_new();
161 g_autoptr(GBytes) message = hex_string_to_bytes(hex_string);
162 g_autoptr(GError) error = nullptr;
163 gboolean result = fl_method_codec_decode_method_call(
164 FL_METHOD_CODEC(codec), message, name, args, &error);
165 EXPECT_TRUE(result);
166 EXPECT_EQ(error, nullptr);
167 }

References args, error, fl_method_codec_decode_method_call(), fl_standard_method_codec_new(), g_autoptr(), and message.

Referenced by TEST().

## ◆ decode_response_with_error()

static void decode_response_with_error | ( | const char * | hex_string,
|  | const gchar * | code,
|  | const gchar * | error_message,
|  | FlValue * | details
| ) |  |
| static

Definition at line 205 of file fl_standard_method_codec_test.cc.

208 {
209 g_autoptr(FlStandardMethodCodec) codec = fl_standard_method_codec_new();
210 g_autoptr(GBytes) message = hex_string_to_bytes(hex_string);
211 g_autoptr(GError) error = nullptr;
212 g_autoptr(FlMethodResponse) response =
213 fl_method_codec_decode_response(FL_METHOD_CODEC(codec), message, &error);
214 ASSERT_NE(response, nullptr);
215 EXPECT_EQ(error, nullptr);
216 EXPECT_TRUE(FL_IS_METHOD_ERROR_RESPONSE(response));
217 EXPECT_STREQ(
218 fl_method_error_response_get_code(FL_METHOD_ERROR_RESPONSE(response)),
219 code);
220 if (error_message == nullptr) {
221 EXPECT_EQ(fl_method_error_response_get_message(
222 FL_METHOD_ERROR_RESPONSE(response)),
223 nullptr);
224 } else {
225 EXPECT_STREQ(fl_method_error_response_get_message(
226 FL_METHOD_ERROR_RESPONSE(response)),
227 error_message);
228 }
229 if (details == nullptr) {
230 EXPECT_EQ(fl_method_error_response_get_details(
231 FL_METHOD_ERROR_RESPONSE(response)),
232 nullptr);
233 } else {
234 EXPECT_TRUE(fl_value_equal(fl_method_error_response_get_details(
235 FL_METHOD_ERROR_RESPONSE(response)),
236 details));
237 }
238 }
fl_method_error_response_get_code
G_MODULE_EXPORT const gchar * fl_method_error_response_get_code(FlMethodErrorResponse *self)
Definition: fl_method_response.cc:160
fl_method_error_response_get_message
G_MODULE_EXPORT const gchar * fl_method_error_response_get_message(FlMethodErrorResponse *self)
Definition: fl_method_response.cc:166
fl_method_error_response_get_details
G_MODULE_EXPORT FlValue * fl_method_error_response_get_details(FlMethodErrorResponse *self)
Definition: fl_method_response.cc:172
fl_value_equal
G_MODULE_EXPORT bool fl_value_equal(FlValue *a, FlValue *b)
Definition: fl_value.cc:471

References error, fl_method_codec_decode_response(), fl_method_error_response_get_code(), fl_method_error_response_get_details(), fl_method_error_response_get_message(), fl_standard_method_codec_new(), fl_value_equal(), g_autoptr(), and message.

Referenced by TEST().

## ◆ decode_response_with_success()

static void decode_response_with_success | ( | const char * | hex_string,
|  | FlValue * | result
| ) |  |
| static

Definition at line 188 of file fl_standard_method_codec_test.cc.

189 {
190 g_autoptr(FlStandardMethodCodec) codec = fl_standard_method_codec_new();
191 g_autoptr(GBytes) message = hex_string_to_bytes(hex_string);
192 g_autoptr(GError) error = nullptr;
193 g_autoptr(FlMethodResponse) response =
194 fl_method_codec_decode_response(FL_METHOD_CODEC(codec), message, &error);
195 ASSERT_NE(response, nullptr);
196 EXPECT_EQ(error, nullptr);
197 EXPECT_TRUE(FL_IS_METHOD_SUCCESS_RESPONSE(response));
198 EXPECT_TRUE(fl_value_equal(fl_method_success_response_get_result(
199 FL_METHOD_SUCCESS_RESPONSE(response)),
200 result));
201 }
fl_method_success_response_get_result
G_MODULE_EXPORT FlValue * fl_method_success_response_get_result(FlMethodSuccessResponse *self)
Definition: fl_method_response.cc:138

References error, fl_method_codec_decode_response(), fl_method_success_response_get_result(), fl_standard_method_codec_new(), fl_value_equal(), g_autoptr(), and message.

Referenced by TEST().

## ◆ encode_error_envelope()

static gchar* encode_error_envelope | ( | const gchar * | error_code,
|  | const gchar * | error_message,
|  | FlValue * | details
| ) |  |
| static

Definition at line 143 of file fl_standard_method_codec_test.cc.

145 {
146 g_autoptr(FlStandardMethodCodec) codec = fl_standard_method_codec_new();
147 g_autoptr(GError) error = nullptr;
148 g_autoptr(GBytes) message = fl_method_codec_encode_error_envelope(
149 FL_METHOD_CODEC(codec), error_code, error_message, details, &error);
150 EXPECT_NE(message, nullptr);
151 EXPECT_EQ(error, nullptr);
152
153 return bytes_to_hex_string(message);
154 }
fl_method_codec_encode_error_envelope
GBytes * fl_method_codec_encode_error_envelope(FlMethodCodec *self, const gchar *code, const gchar *message, FlValue *details, GError **error)
Definition: fl_method_codec.cc:50

References error, fl_method_codec_encode_error_envelope(), fl_standard_method_codec_new(), g_autoptr(), and message.

Referenced by TEST().

## ◆ encode_method_call()

static gchar* encode_method_call | ( | const gchar * | name,
|  | FlValue * | args
| ) |  |
| static

Definition at line 118 of file fl_standard_method_codec_test.cc.

118 {
119 g_autoptr(FlStandardMethodCodec) codec = fl_standard_method_codec_new();
120 g_autoptr(GError) error = nullptr;
121 g_autoptr(GBytes) message = fl_method_codec_encode_method_call(
122 FL_METHOD_CODEC(codec), name, args, &error);
123 EXPECT_NE(message, nullptr);
124 EXPECT_EQ(error, nullptr);
125
126 return bytes_to_hex_string(message);
127 }
fl_method_codec_encode_method_call
GBytes * fl_method_codec_encode_method_call(FlMethodCodec *self, const gchar *name, FlValue *args, GError **error)
Definition: fl_method_codec.cc:16

References args, error, fl_method_codec_encode_method_call(), fl_standard_method_codec_new(), g_autoptr(), and message.

Referenced by TEST().

## ◆ encode_success_envelope()

static gchar* encode_success_envelope | ( | FlValue * | result | ) |
| static

Definition at line 131 of file fl_standard_method_codec_test.cc.

131 {
132 g_autoptr(FlStandardMethodCodec) codec = fl_standard_method_codec_new();
133 g_autoptr(GError) error = nullptr;
134 g_autoptr(GBytes) message = fl_method_codec_encode_success_envelope(
135 FL_METHOD_CODEC(codec), result, &error);
136 EXPECT_NE(message, nullptr);
137 EXPECT_EQ(error, nullptr);
138
139 return bytes_to_hex_string(message);
140 }
fl_method_codec_encode_success_envelope
GBytes * fl_method_codec_encode_success_envelope(FlMethodCodec *self, FlValue *result, GError **error)
Definition: fl_method_codec.cc:41

References error, fl_method_codec_encode_success_envelope(), fl_standard_method_codec_new(), g_autoptr(), and message.

Referenced by TEST().

## ◆ fl_standard_message_codec_write_size()

fl_standard_message_codec_write_size | ( | codec | ,
|  | buffer | ,
|  | length |
| ) |  |

## ◆ fl_test_method_message_codec_class_init()

static void fl_test_method_message_codec_class_init | ( | FlTestMethodMessageCodecClass * | klass | ) |
| static

Definition at line 96 of file fl_standard_method_codec_test.cc.

97 {
98 FL_STANDARD_MESSAGE_CODEC_CLASS(klass)->write_value =
99 fl_test_method_message_codec_write_value;
100 FL_STANDARD_MESSAGE_CODEC_CLASS(klass)->read_value_of_type =
101 fl_test_method_message_codec_read_value_of_type;
102 }
fl_test_method_message_codec_read_value_of_type
static FlValue * fl_test_method_message_codec_read_value_of_type(FlStandardMessageCodec *codec, GBytes *buffer, size_t *offset, int type, GError **error)
Definition: fl_standard_method_codec_test.cc:81
fl_test_method_message_codec_write_value
static gboolean fl_test_method_message_codec_write_value(FlStandardMessageCodec *codec, GByteArray *buffer, FlValue *value, GError **error)
Definition: fl_standard_method_codec_test.cc:41

References fl_test_method_message_codec_read_value_of_type(), and fl_test_method_message_codec_write_value().

## ◆ fl_test_method_message_codec_init()

static void fl_test_method_message_codec_init | ( | FlTestMethodMessageCodec * | self | ) |
| static

Definition at line 104 of file fl_standard_method_codec_test.cc.

104 {
105 // The following line suppresses a warning for unused function
106 FL_IS_TEST_METHOD_MESSAGE_CODEC(self);
107 }

## ◆ fl_test_method_message_codec_new()

static FlTestMethodMessageCodec* fl_test_method_message_codec_new | ( |  | ) |
| static

Definition at line 109 of file fl_standard_method_codec_test.cc.

109 {
110 return FL_TEST_METHOD_MESSAGE_CODEC(
111 g_object_new(fl_test_method_message_codec_get_type(), nullptr));
112 }

Referenced by TEST().

## ◆ fl_test_method_message_codec_read_value_of_type()

static FlValue* fl_test_method_message_codec_read_value_of_type | ( | FlStandardMessageCodec * | codec,
|  | GBytes * | buffer,
|  | size_t * | offset,
|  | int | type,
|  | GError ** | error
| ) |  |
| static

Definition at line 81 of file fl_standard_method_codec_test.cc.

86 {
87 if (type == 128) {
88 return read_custom_value(codec, buffer, offset, error);
89 } else {
90 return FL_STANDARD_MESSAGE_CODEC_CLASS(
91 fl_test_method_message_codec_parent_class)
92 ->read_value_of_type(codec, buffer, offset, type, error);
93 }
94 }
type
uint8_t type
Definition: fl_standard_method_codec_test.cc:34
buffer
GByteArray * buffer
Definition: fl_standard_method_codec_test.cc:27
read_custom_value
static FlValue * read_custom_value(FlStandardMessageCodec *codec, GBytes *buffer, size_t *offset, GError **error)
Definition: fl_standard_method_codec_test.cc:56

References buffer, error, read_custom_value(), and type.

Referenced by fl_test_method_message_codec_class_init().

## ◆ fl_test_method_message_codec_write_value()

static gboolean fl_test_method_message_codec_write_value | ( | FlStandardMessageCodec * | codec,
|  | GByteArray * | buffer,
|  | FlValue * | value,
|  | GError ** | error
| ) |  |
| static

Definition at line 41 of file fl_standard_method_codec_test.cc.

45 {
46 if (fl_value_get_type(value) == FL_VALUE_TYPE_CUSTOM &&
47 fl_value_get_custom_type(value) == 128) {
48 return write_custom_value(codec, buffer, value, error);
49 } else {
50 return FL_STANDARD_MESSAGE_CODEC_CLASS(
51 fl_test_method_message_codec_parent_class)
52 ->write_value(codec, buffer, value, error);
53 }
54 }
value
GByteArray FlValue * value
Definition: fl_standard_method_codec_test.cc:28
fl_value_get_type
G_MODULE_EXPORT FlValueType fl_value_get_type(FlValue *self)
Definition: fl_value.cc:466
fl_value_get_custom_type
G_MODULE_EXPORT int fl_value_get_custom_type(FlValue *self)
Definition: fl_value.cc:822
FL_VALUE_TYPE_CUSTOM
@ FL_VALUE_TYPE_CUSTOM
Definition: fl_value.h:76

References buffer, error, fl_value_get_custom_type(), fl_value_get_type(), FL_VALUE_TYPE_CUSTOM, and value.

Referenced by fl_test_method_message_codec_class_init().

## ◆ g_byte_array_append() [1/2]

g_byte_array_append | ( | buffer | ,
|  | & | type,
|  | sizeof(uint8_t) |
| ) |  |

## ◆ g_byte_array_append() [2/2]

g_byte_array_append | ( | buffer | ,
|  | reinterpret_cast< const uint8_t * > | text,
|  | length |
| ) |  |

## ◆ G_DECLARE_FINAL_TYPE()

G_DECLARE_FINAL_TYPE | ( | FlTestMethodMessageCodec | ,
|  | fl_test_method_message_codec | ,
|  | FL | ,
|  | TEST_METHOD_MESSAGE_CODEC | ,
|  | FlStandardMessageCodec |
| ) |  |

Definition at line 12 of file fl_standard_method_codec_test.cc.

18 {
19 FlStandardMessageCodec parent_instance;
20 };

## ◆ G_DEFINE_TYPE()

G_DEFINE_TYPE | ( | FlTestMethodMessageCodec | ,
|  | fl_test_method_message_codec | ,
|  | fl_standard_message_codec_get_type() |
| ) |  |

## ◆ read_custom_value()

static FlValue* read_custom_value | ( | FlStandardMessageCodec * | codec,
|  | GBytes * | buffer,
|  | size_t * | offset,
|  | GError ** | error
| ) |  |
| static

Definition at line 56 of file fl_standard_method_codec_test.cc.

59 {
60 uint32_t length;
61 if (!fl_standard_message_codec_read_size(codec, buffer, offset, &length,
62 error)) {
63 return nullptr;
64 }
65 if (*offset + length > g_bytes_get_size(buffer)) {
66 g_set_error(error, FL_MESSAGE_CODEC_ERROR,
67 FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA, "Unexpected end of data");
68 return nullptr;
69 }
70 FlValue* value = fl_value_new_custom(
71 128,
72 g_strndup(static_cast<const gchar*>(g_bytes_get_data(buffer, nullptr)) +
73 *offset,
74 length),
75 g_free);
76 *offset += length;
77
78 return value;
79 }
FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA
@ FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA
Definition: fl_message_codec.h:34
FL_MESSAGE_CODEC_ERROR
#define FL_MESSAGE_CODEC_ERROR
Definition: fl_message_codec.h:30
fl_standard_message_codec_read_size
G_MODULE_EXPORT gboolean fl_standard_message_codec_read_size(FlStandardMessageCodec *codec, GBytes *buffer, size_t *offset, uint32_t *value, GError **error)
Definition: fl_standard_message_codec.cc:658
length
size_t length
Definition: fl_standard_method_codec_test.cc:32
fl_value_new_custom
G_MODULE_EXPORT FlValue * fl_value_new_custom(int type, gconstpointer value, GDestroyNotify destroy_notify)
Definition: fl_value.cc:374

References buffer, error, FL_MESSAGE_CODEC_ERROR, FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA, fl_standard_message_codec_read_size(), fl_value_new_custom(), length, and value.

Referenced by fl_test_method_message_codec_read_value_of_type().

## ◆ TEST() [1/36]

TEST | ( | FlStandardMethodCodecTest | ,
|  | CustomMessageCodec |
| ) |  |

Definition at line 482 of file fl_standard_method_codec_test.cc.

482 {
483 g_autoptr(FlTestMethodMessageCodec) message_codec =
484 fl_test_method_message_codec_new();
485 g_autoptr(FlStandardMethodCodec) codec =
486 fl_standard_method_codec_new_with_message_codec(
487 FL_STANDARD_MESSAGE_CODEC(message_codec));
488
489 g_autoptr(GError) error = nullptr;
490 g_autoptr(FlValue) value = fl_value_new_custom(128, "hello", nullptr);
491 g_autoptr(GBytes) message = fl_method_codec_encode_success_envelope(
492 FL_METHOD_CODEC(codec), value, &error);
493 EXPECT_NE(message, nullptr);
494 EXPECT_EQ(error, nullptr);
495 g_autofree gchar* hex_string = bytes_to_hex_string(message);
496 EXPECT_STREQ(hex_string, "00800568656c6c6f");
497
498 g_autoptr(FlMethodResponse) response =
499 fl_method_codec_decode_response(FL_METHOD_CODEC(codec), message, &error);
500 EXPECT_NE(response, nullptr);
501 EXPECT_EQ(error, nullptr);
502 EXPECT_TRUE(FL_IS_METHOD_SUCCESS_RESPONSE(response));
503 FlValue* result = fl_method_success_response_get_result(
504 FL_METHOD_SUCCESS_RESPONSE(response));
505 ASSERT_EQ(fl_value_get_type(result), FL_VALUE_TYPE_CUSTOM);
506 ASSERT_EQ(fl_value_get_custom_type(result), 128);
507 EXPECT_STREQ(static_cast<const gchar*>(fl_value_get_custom_value(result)),
508 "hello");
509 }
fl_standard_method_codec_new_with_message_codec
G_MODULE_EXPORT FlStandardMethodCodec * fl_standard_method_codec_new_with_message_codec(FlStandardMessageCodec *message_codec)
Definition: fl_standard_method_codec.cc:298
fl_test_method_message_codec_new
static FlTestMethodMessageCodec * fl_test_method_message_codec_new()
Definition: fl_standard_method_codec_test.cc:109
fl_value_get_custom_value
G_MODULE_EXPORT gconstpointer fl_value_get_custom_value(FlValue *self)
Definition: fl_value.cc:830

References error, fl_method_codec_decode_response(), fl_method_codec_encode_success_envelope(), fl_method_success_response_get_result(), fl_standard_method_codec_new_with_message_codec(), fl_test_method_message_codec_new(), fl_value_get_custom_type(), fl_value_get_custom_value(), fl_value_get_type(), fl_value_new_custom(), FL_VALUE_TYPE_CUSTOM, g_autoptr(), message, and value.

## ◆ TEST() [2/36]

TEST | ( | FlStandardMethodCodecTest | ,
|  | DecodeMethodCallListArgs |
| ) |  |

Definition at line 294 of file fl_standard_method_codec_test.cc.

294 {
295 g_autofree gchar* name = nullptr;
296 g_autoptr(FlValue) args = nullptr;
297 decode_method_call("070568656c6c6f0c020705636f756e74032a000000", &name,
298 &args);
299 EXPECT_STREQ(name, "hello");
300 ASSERT_EQ(fl_value_get_type(args), FL_VALUE_TYPE_LIST);
301 EXPECT_EQ(fl_value_get_length(args), static_cast<size_t>(2));
302
303 FlValue* arg0 = fl_value_get_list_value(args, 0);
304 ASSERT_EQ(fl_value_get_type(arg0), FL_VALUE_TYPE_STRING);
305 EXPECT_STREQ(fl_value_get_string(arg0), "count");
306
307 FlValue* arg1 = fl_value_get_list_value(args, 1);
308 ASSERT_EQ(fl_value_get_type(arg1), FL_VALUE_TYPE_INT);
309 EXPECT_EQ(fl_value_get_int(arg1), 42);
310 }
decode_method_call
static void decode_method_call(const char *hex_string, gchar **name, FlValue **args)
Definition: fl_standard_method_codec_test.cc:157
fl_value_get_list_value
G_MODULE_EXPORT FlValue * fl_value_get_list_value(FlValue *self, size_t index)
Definition: fl_value.cc:776
fl_value_get_int
G_MODULE_EXPORT int64_t fl_value_get_int(FlValue *self)
Definition: fl_value.cc:668
fl_value_get_string
G_MODULE_EXPORT const gchar * fl_value_get_string(FlValue *self)
Definition: fl_value.cc:682
fl_value_get_length
G_MODULE_EXPORT size_t fl_value_get_length(FlValue *self)
Definition: fl_value.cc:724
FL_VALUE_TYPE_STRING
@ FL_VALUE_TYPE_STRING
Definition: fl_value.h:68
FL_VALUE_TYPE_INT
@ FL_VALUE_TYPE_INT
Definition: fl_value.h:66
FL_VALUE_TYPE_LIST
@ FL_VALUE_TYPE_LIST
Definition: fl_value.h:73

References args, decode_method_call(), fl_value_get_int(), fl_value_get_length(), fl_value_get_list_value(), fl_value_get_string(), fl_value_get_type(), FL_VALUE_TYPE_INT, FL_VALUE_TYPE_LIST, FL_VALUE_TYPE_STRING, and g_autoptr().

## ◆ TEST() [3/36]

TEST | ( | FlStandardMethodCodecTest | ,
|  | DecodeMethodCallMissingArgs |
| ) |  |

Definition at line 322 of file fl_standard_method_codec_test.cc.

322 {
323 decode_error_method_call("070568656c6c6f", FL_MESSAGE_CODEC_ERROR,
324 FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA);
325 }
decode_error_method_call
static void decode_error_method_call(const char *hex_string, GQuark domain, gint code)
Definition: fl_standard_method_codec_test.cc:170

References decode_error_method_call(), FL_MESSAGE_CODEC_ERROR, and FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA.

## ◆ TEST() [4/36]

TEST | ( | FlStandardMethodCodecTest | ,
|  | DecodeMethodCallNoData |
| ) |  |

Definition at line 312 of file fl_standard_method_codec_test.cc.

312 {
313 decode_error_method_call("", FL_MESSAGE_CODEC_ERROR,
314 FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA);
315 }

References decode_error_method_call(), FL_MESSAGE_CODEC_ERROR, and FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA.

## ◆ TEST() [5/36]

TEST | ( | FlStandardMethodCodecTest | ,
|  | DecodeMethodCallNullArgs |
| ) |  |

Definition at line 277 of file fl_standard_method_codec_test.cc.

277 {
278 g_autofree gchar* name = nullptr;
279 g_autoptr(FlValue) args = nullptr;
280 decode_method_call("070568656c6c6f00", &name, &args);
281 EXPECT_STREQ(name, "hello");
282 ASSERT_EQ(fl_value_get_type(args), FL_VALUE_TYPE_NULL);
283 }
FL_VALUE_TYPE_NULL
@ FL_VALUE_TYPE_NULL
Definition: fl_value.h:64

References args, decode_method_call(), fl_value_get_type(), FL_VALUE_TYPE_NULL, and g_autoptr().

## ◆ TEST() [6/36]

TEST | ( | FlStandardMethodCodecTest | ,
|  | DecodeMethodCallNullMethodName |
| ) |  |

Definition at line 317 of file fl_standard_method_codec_test.cc.

317 {
318 decode_error_method_call("000000", FL_MESSAGE_CODEC_ERROR,
319 FL_MESSAGE_CODEC_ERROR_FAILED);
320 }
FL_MESSAGE_CODEC_ERROR_FAILED
@ FL_MESSAGE_CODEC_ERROR_FAILED
Definition: fl_message_codec.h:33

References decode_error_method_call(), FL_MESSAGE_CODEC_ERROR, and FL_MESSAGE_CODEC_ERROR_FAILED.

## ◆ TEST() [7/36]

TEST | ( | FlStandardMethodCodecTest | ,
|  | DecodeMethodCallStringArgs |
| ) |  |

Definition at line 285 of file fl_standard_method_codec_test.cc.

285 {
286 g_autofree gchar* name = nullptr;
287 g_autoptr(FlValue) args = nullptr;
288 decode_method_call("070568656c6c6f0705776f726c64", &name, &args);
289 EXPECT_STREQ(name, "hello");
290 ASSERT_EQ(fl_value_get_type(args), FL_VALUE_TYPE_STRING);
291 EXPECT_STREQ(fl_value_get_string(args), "world");
292 }

References args, decode_method_call(), fl_value_get_string(), fl_value_get_type(), FL_VALUE_TYPE_STRING, and g_autoptr().

## ◆ TEST() [8/36]

TEST | ( | FlStandardMethodCodecTest | ,
|  | DecodeResponseErrorDetails |
| ) |  |

Definition at line 419 of file fl_standard_method_codec_test.cc.

419 {
420 g_autoptr(FlValue) details = fl_value_new_list();
421 fl_value_append_take(details, fl_value_new_string("count"));
422 fl_value_append_take(details, fl_value_new_int(42));
423 decode_response_with_error("0107056572726f72000c020705636f756e74032a000000",
424 "error", nullptr, details);
425 }
decode_response_with_error
static void decode_response_with_error(const char *hex_string, const gchar *code, const gchar *error_message, FlValue *details)
Definition: fl_standard_method_codec_test.cc:205
fl_value_new_string
G_MODULE_EXPORT FlValue * fl_value_new_string(const gchar *value)
Definition: fl_value.cc:276
fl_value_new_list
G_MODULE_EXPORT FlValue * fl_value_new_list()
Definition: fl_value.cc:349
fl_value_append_take
G_MODULE_EXPORT void fl_value_append_take(FlValue *self, FlValue *value)
Definition: fl_value.cc:600
fl_value_new_int
G_MODULE_EXPORT FlValue * fl_value_new_int(int64_t value)
Definition: fl_value.cc:262

References decode_response_with_error(), fl_value_append_take(), fl_value_new_int(), fl_value_new_list(), fl_value_new_string(), and g_autoptr().

## ◆ TEST() [9/36]

TEST | ( | FlStandardMethodCodecTest | ,
|  | DecodeResponseErrorEmptyCode |
| ) |  |

Definition at line 406 of file fl_standard_method_codec_test.cc.

406 {
407 decode_response_with_error("0107000000", "", nullptr, nullptr);
408 }

References decode_response_with_error().

## ◆ TEST() [10/36]

TEST | ( | FlStandardMethodCodecTest | ,
|  | DecodeResponseErrorExtraData |
| ) |  |

Definition at line 461 of file fl_standard_method_codec_test.cc.

461 {
462 decode_error_response("0107056572726f72000000", FL_MESSAGE_CODEC_ERROR,
463 FL_MESSAGE_CODEC_ERROR_FAILED);
464 }
decode_error_response
static void decode_error_response(const char *hex_string, GQuark domain, gint code)
Definition: fl_standard_method_codec_test.cc:240

References decode_error_response(), FL_MESSAGE_CODEC_ERROR, and FL_MESSAGE_CODEC_ERROR_FAILED.

## ◆ TEST() [11/36]

TEST | ( | FlStandardMethodCodecTest | ,
|  | DecodeResponseErrorMessage |
| ) |  |

Definition at line 414 of file fl_standard_method_codec_test.cc.

414 {
415 decode_response_with_error("0107056572726f7207076d65737361676500", "error",
416 "message", nullptr);
417 }

References decode_response_with_error().

## ◆ TEST() [12/36]

TEST | ( | FlStandardMethodCodecTest | ,
|  | DecodeResponseErrorMessageAndDetails |
| ) |  |

Definition at line 427 of file fl_standard_method_codec_test.cc.

427 {
428 g_autoptr(FlValue) details = fl_value_new_list();
429 fl_value_append_take(details, fl_value_new_string("count"));
430 fl_value_append_take(details, fl_value_new_int(42));
431 decode_response_with_error(
432 "0107056572726f7207076d6573736167650c020705636f756e74032a000000", "error",
433 "message", details);
434 }

References decode_response_with_error(), fl_value_append_take(), fl_value_new_int(), fl_value_new_list(), fl_value_new_string(), and g_autoptr().

## ◆ TEST() [13/36]

TEST | ( | FlStandardMethodCodecTest | ,
|  | DecodeResponseErrorMissingDetails |
| ) |  |

Definition at line 456 of file fl_standard_method_codec_test.cc.

456 {
457 decode_error_response("0107056572726f7200", FL_MESSAGE_CODEC_ERROR,
458 FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA);
459 }

References decode_error_response(), FL_MESSAGE_CODEC_ERROR, and FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA.

## ◆ TEST() [14/36]

TEST | ( | FlStandardMethodCodecTest | ,
|  | DecodeResponseErrorMissingMessageAndDetails |
| ) |  |

Definition at line 451 of file fl_standard_method_codec_test.cc.

451 {
452 decode_error_response("0107056572726f72", FL_MESSAGE_CODEC_ERROR,
453 FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA);
454 }

References decode_error_response(), FL_MESSAGE_CODEC_ERROR, and FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA.

## ◆ TEST() [15/36]

TEST | ( | FlStandardMethodCodecTest | ,
|  | DecodeResponseErrorNoData |
| ) |  |

Definition at line 446 of file fl_standard_method_codec_test.cc.

446 {
447 decode_error_response("01", FL_MESSAGE_CODEC_ERROR,
448 FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA);
449 }

References decode_error_response(), FL_MESSAGE_CODEC_ERROR, and FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA.

## ◆ TEST() [16/36]

TEST | ( | FlStandardMethodCodecTest | ,
|  | DecodeResponseErrorNoMessageOrDetails |
| ) |  |

Definition at line 410 of file fl_standard_method_codec_test.cc.

410 {
411 decode_response_with_error("0107056572726f720000", "error", nullptr, nullptr);
412 }

References decode_response_with_error().

## ◆ TEST() [17/36]

TEST | ( | FlStandardMethodCodecTest | ,
|  | DecodeResponseNotImplemented |
| ) |  |

Definition at line 466 of file fl_standard_method_codec_test.cc.

466 {
467 g_autoptr(FlStandardMethodCodec) codec = fl_standard_method_codec_new();
468 g_autoptr(GBytes) message = g_bytes_new(nullptr, 0);
469 g_autoptr(GError) error = nullptr;
470 g_autoptr(FlMethodResponse) response =
471 fl_method_codec_decode_response(FL_METHOD_CODEC(codec), message, &error);
472 ASSERT_NE(response, nullptr);
473 EXPECT_EQ(error, nullptr);
474 EXPECT_TRUE(FL_IS_METHOD_NOT_IMPLEMENTED_RESPONSE(response));
475 }

References error, fl_method_codec_decode_response(), fl_standard_method_codec_new(), g_autoptr(), and message.

## ◆ TEST() [18/36]

TEST | ( | FlStandardMethodCodecTest | ,
|  | DecodeResponseSuccessExtraData |
| ) |  |

Definition at line 441 of file fl_standard_method_codec_test.cc.

441 {
442 decode_error_response("000000", FL_MESSAGE_CODEC_ERROR,
443 FL_MESSAGE_CODEC_ERROR_FAILED);
444 }

References decode_error_response(), FL_MESSAGE_CODEC_ERROR, and FL_MESSAGE_CODEC_ERROR_FAILED.

## ◆ TEST() [19/36]

TEST | ( | FlStandardMethodCodecTest | ,
|  | DecodeResponseSuccessList |
| ) |  |

Definition at line 399 of file fl_standard_method_codec_test.cc.

399 {
400 g_autoptr(FlValue) result = fl_value_new_list();
401 fl_value_append_take(result, fl_value_new_string("count"));
402 fl_value_append_take(result, fl_value_new_int(42));
403 decode_response_with_success("000c020705636f756e74032a000000", result);
404 }
decode_response_with_success
static void decode_response_with_success(const char *hex_string, FlValue *result)
Definition: fl_standard_method_codec_test.cc:188

References decode_response_with_success(), fl_value_append_take(), fl_value_new_int(), fl_value_new_list(), fl_value_new_string(), and g_autoptr().

## ◆ TEST() [20/36]

TEST | ( | FlStandardMethodCodecTest | ,
|  | DecodeResponseSuccessNoData |
| ) |  |

Definition at line 436 of file fl_standard_method_codec_test.cc.

436 {
437 decode_error_response("00", FL_MESSAGE_CODEC_ERROR,
438 FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA);
439 }

References decode_error_response(), FL_MESSAGE_CODEC_ERROR, and FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA.

## ◆ TEST() [21/36]

TEST | ( | FlStandardMethodCodecTest | ,
|  | DecodeResponseSuccessNull |
| ) |  |

Definition at line 389 of file fl_standard_method_codec_test.cc.

389 {
390 g_autoptr(FlValue) result = fl_value_new_null();
391 decode_response_with_success("0000", result);
392 }
fl_value_new_null
G_MODULE_EXPORT FlValue * fl_value_new_null()
Definition: fl_value.cc:251

References decode_response_with_success(), fl_value_new_null(), and g_autoptr().

## ◆ TEST() [22/36]

TEST | ( | FlStandardMethodCodecTest | ,
|  | DecodeResponseSuccessString |
| ) |  |

Definition at line 394 of file fl_standard_method_codec_test.cc.

394 {
395 g_autoptr(FlValue) result = fl_value_new_string("hello");
396 decode_response_with_success("00070568656c6c6f", result);
397 }

References decode_response_with_success(), fl_value_new_string(), and g_autoptr().

## ◆ TEST() [23/36]

TEST | ( | FlStandardMethodCodecTest | ,
|  | DecodeResponseUnknownEnvelope |
| ) |  |

Definition at line 477 of file fl_standard_method_codec_test.cc.

477 {
478 decode_error_response("02", FL_MESSAGE_CODEC_ERROR,
479 FL_MESSAGE_CODEC_ERROR_FAILED);
480 }

References decode_error_response(), FL_MESSAGE_CODEC_ERROR, and FL_MESSAGE_CODEC_ERROR_FAILED.

## ◆ TEST() [24/36]

TEST | ( | FlStandardMethodCodecTest | ,
|  | EncodeErrorEnvelopeDetails |
| ) |  |

Definition at line 369 of file fl_standard_method_codec_test.cc.

369 {
370 g_autoptr(FlValue) details = fl_value_new_list();
371 fl_value_append_take(details, fl_value_new_string("count"));
372 fl_value_append_take(details, fl_value_new_int(42));
373 g_autofree gchar* hex_string =
374 encode_error_envelope("error", nullptr, details);
375 EXPECT_STREQ(hex_string, "0107056572726f72000c020705636f756e74032a000000");
376 }
encode_error_envelope
static gchar * encode_error_envelope(const gchar *error_code, const gchar *error_message, FlValue *details)
Definition: fl_standard_method_codec_test.cc:143

References encode_error_envelope(), fl_value_append_take(), fl_value_new_int(), fl_value_new_list(), fl_value_new_string(), and g_autoptr().

## ◆ TEST() [25/36]

TEST | ( | FlStandardMethodCodecTest | ,
|  | EncodeErrorEnvelopeEmptyCode |
| ) |  |

Definition at line 352 of file fl_standard_method_codec_test.cc.

352 {
353 g_autofree gchar* hex_string = encode_error_envelope("", nullptr, nullptr);
354 EXPECT_STREQ(hex_string, "0107000000");
355 }

References encode_error_envelope().

## ◆ TEST() [26/36]

TEST | ( | FlStandardMethodCodecTest | ,
|  | EncodeErrorEnvelopeMessage |
| ) |  |

Definition at line 363 of file fl_standard_method_codec_test.cc.

363 {
364 g_autofree gchar* hex_string =
365 encode_error_envelope("error", "message", nullptr);
366 EXPECT_STREQ(hex_string, "0107056572726f7207076d65737361676500");
367 }

References encode_error_envelope().

## ◆ TEST() [27/36]

TEST | ( | FlStandardMethodCodecTest | ,
|  | EncodeErrorEnvelopeMessageAndDetails |
| ) |  |

Definition at line 378 of file fl_standard_method_codec_test.cc.

378 {
379 g_autoptr(FlValue) details = fl_value_new_list();
380 fl_value_append_take(details, fl_value_new_string("count"));
381 fl_value_append_take(details, fl_value_new_int(42));
382 g_autofree gchar* hex_string =
383 encode_error_envelope("error", "message", details);
384 EXPECT_STREQ(
385 hex_string,
386 "0107056572726f7207076d6573736167650c020705636f756e74032a000000");
387 }

References encode_error_envelope(), fl_value_append_take(), fl_value_new_int(), fl_value_new_list(), fl_value_new_string(), and g_autoptr().

## ◆ TEST() [28/36]

TEST | ( | FlStandardMethodCodecTest | ,
|  | EncodeErrorEnvelopeNonMessageOrDetails |
| ) |  |

Definition at line 357 of file fl_standard_method_codec_test.cc.

357 {
358 g_autofree gchar* hex_string =
359 encode_error_envelope("error", nullptr, nullptr);
360 EXPECT_STREQ(hex_string, "0107056572726f720000");
361 }

References encode_error_envelope().

## ◆ TEST() [29/36]

TEST | ( | FlStandardMethodCodecTest | ,
|  | EncodeMethodCallListArgs |
| ) |  |

Definition at line 269 of file fl_standard_method_codec_test.cc.

269 {
270 g_autoptr(FlValue) args = fl_value_new_list();
271 fl_value_append_take(args, fl_value_new_string("count"));
272 fl_value_append_take(args, fl_value_new_int(42));
273 g_autofree gchar* hex_string = encode_method_call("hello", args);
274 EXPECT_STREQ(hex_string, "070568656c6c6f0c020705636f756e74032a000000");
275 }
encode_method_call
static gchar * encode_method_call(const gchar *name, FlValue *args)
Definition: fl_standard_method_codec_test.cc:118

References args, encode_method_call(), fl_value_append_take(), fl_value_new_int(), fl_value_new_list(), fl_value_new_string(), and g_autoptr().

## ◆ TEST() [30/36]

TEST | ( | FlStandardMethodCodecTest | ,
|  | EncodeMethodCallNullArgs |
| ) |  |

Definition at line 257 of file fl_standard_method_codec_test.cc.

257 {
258 g_autoptr(FlValue) value = fl_value_new_null();
259 g_autofree gchar* hex_string = encode_method_call("hello", value);
260 EXPECT_STREQ(hex_string, "070568656c6c6f00");
261 }

References encode_method_call(), fl_value_new_null(), g_autoptr(), and value.

## ◆ TEST() [31/36]

TEST | ( | FlStandardMethodCodecTest | ,
|  | EncodeMethodCallNullptrArgs |
| ) |  |

Definition at line 252 of file fl_standard_method_codec_test.cc.

252 {
253 g_autofree gchar* hex_string = encode_method_call("hello", nullptr);
254 EXPECT_STREQ(hex_string, "070568656c6c6f00");
255 }

References encode_method_call().

## ◆ TEST() [32/36]

TEST | ( | FlStandardMethodCodecTest | ,
|  | EncodeMethodCallStringArgs |
| ) |  |

Definition at line 263 of file fl_standard_method_codec_test.cc.

263 {
264 g_autoptr(FlValue) args = fl_value_new_string("world");
265 g_autofree gchar* hex_string = encode_method_call("hello", args);
266 EXPECT_STREQ(hex_string, "070568656c6c6f0705776f726c64");
267 }

References args, encode_method_call(), fl_value_new_string(), and g_autoptr().

## ◆ TEST() [33/36]

TEST | ( | FlStandardMethodCodecTest | ,
|  | EncodeSuccessEnvelopeList |
| ) |  |

Definition at line 344 of file fl_standard_method_codec_test.cc.

344 {
345 g_autoptr(FlValue) result = fl_value_new_list();
346 fl_value_append_take(result, fl_value_new_string("count"));
347 fl_value_append_take(result, fl_value_new_int(42));
348 g_autofree gchar* hex_string = encode_success_envelope(result);
349 EXPECT_STREQ(hex_string, "000c020705636f756e74032a000000");
350 }
encode_success_envelope
static gchar * encode_success_envelope(FlValue *result)
Definition: fl_standard_method_codec_test.cc:131

References encode_success_envelope(), fl_value_append_take(), fl_value_new_int(), fl_value_new_list(), fl_value_new_string(), and g_autoptr().

## ◆ TEST() [34/36]

TEST | ( | FlStandardMethodCodecTest | ,
|  | EncodeSuccessEnvelopeNull |
| ) |  |

Definition at line 332 of file fl_standard_method_codec_test.cc.

332 {
333 g_autoptr(FlValue) result = fl_value_new_null();
334 g_autofree gchar* hex_string = encode_success_envelope(result);
335 EXPECT_STREQ(hex_string, "0000");
336 }

References encode_success_envelope(), fl_value_new_null(), and g_autoptr().

## ◆ TEST() [35/36]

TEST | ( | FlStandardMethodCodecTest | ,
|  | EncodeSuccessEnvelopeNullptr |
| ) |  |

Definition at line 327 of file fl_standard_method_codec_test.cc.

327 {
328 g_autofree gchar* hex_string = encode_success_envelope(nullptr);
329 EXPECT_STREQ(hex_string, "0000");
330 }

References encode_success_envelope().

## ◆ TEST() [36/36]

TEST | ( | FlStandardMethodCodecTest | ,
|  | EncodeSuccessEnvelopeString |
| ) |  |

Definition at line 338 of file fl_standard_method_codec_test.cc.

338 {
339 g_autoptr(FlValue) result = fl_value_new_string("hello");
340 g_autofree gchar* hex_string = encode_success_envelope(result);
341 EXPECT_STREQ(hex_string, "00070568656c6c6f");
342 }

References encode_success_envelope(), fl_value_new_string(), and g_autoptr().

## Variable Documentation

## ◆ buffer

GByteArray* buffer

Definition at line 27 of file fl_standard_method_codec_test.cc.

Referenced by fl_test_method_message_codec_read_value_of_type(), fl_test_method_message_codec_write_value(), and read_custom_value().

## ◆ error

GByteArray FlValue GError** error

Initial value:
{
const gchar* text =
static_cast<const gchar*>(fl_value_get_custom_value(value))

Definition at line 29 of file fl_standard_method_codec_test.cc.

Referenced by decode_error_method_call(), decode_error_response(), decode_method_call(), decode_response_with_error(), decode_response_with_success(), encode_error_envelope(), encode_method_call(), encode_success_envelope(), fl_test_method_message_codec_read_value_of_type(), fl_test_method_message_codec_write_value(), read_custom_value(), and TEST().

## ◆ length

size_t length = strlen(text)

Definition at line 32 of file fl_standard_method_codec_test.cc.

Referenced by read_custom_value().

## ◆ TRUE

return TRUE

Definition at line 38 of file fl_standard_method_codec_test.cc.

## ◆ type

uint8_t type = 128

Definition at line 34 of file fl_standard_method_codec_test.cc.

Referenced by fl_test_method_message_codec_read_value_of_type().

## ◆ value

GByteArray FlValue* value

Definition at line 28 of file fl_standard_method_codec_test.cc.

Referenced by fl_test_method_message_codec_write_value(), read_custom_value(), and TEST().