#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 |
|
static |
Definition at line 170 of file fl_standard_method_codec_test.cc.
References args, error, fl_method_codec_decode_method_call(), fl_standard_method_codec_new(), and result.
Referenced by TEST().
|
static |
Definition at line 240 of file fl_standard_method_codec_test.cc.
References error, fl_method_codec_decode_response(), and fl_standard_method_codec_new().
Referenced by TEST().
|
static |
Definition at line 157 of file fl_standard_method_codec_test.cc.
References args, error, fl_method_codec_decode_method_call(), fl_standard_method_codec_new(), and result.
Referenced by TEST().
|
static |
Definition at line 205 of file fl_standard_method_codec_test.cc.
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(), and fl_value_equal().
Referenced by TEST().
|
static |
Definition at line 188 of file fl_standard_method_codec_test.cc.
References error, fl_method_codec_decode_response(), fl_method_success_response_get_result(), fl_standard_method_codec_new(), fl_value_equal(), and result.
Referenced by TEST().
|
static |
Definition at line 143 of file fl_standard_method_codec_test.cc.
References error, fl_method_codec_encode_error_envelope(), and fl_standard_method_codec_new().
Referenced by TEST().
|
static |
Definition at line 118 of file fl_standard_method_codec_test.cc.
References args, error, fl_method_codec_encode_method_call(), and fl_standard_method_codec_new().
Referenced by TEST().
|
static |
Definition at line 131 of file fl_standard_method_codec_test.cc.
References error, fl_method_codec_encode_success_envelope(), fl_standard_method_codec_new(), and result.
Referenced by TEST().
|
static |
Definition at line 96 of file fl_standard_method_codec_test.cc.
References fl_test_method_message_codec_read_value_of_type(), and fl_test_method_message_codec_write_value().
|
static |
Definition at line 104 of file fl_standard_method_codec_test.cc.
|
static |
|
static |
Definition at line 81 of file fl_standard_method_codec_test.cc.
References buffer, error, read_custom_value(), and type.
Referenced by fl_test_method_message_codec_class_init().
|
static |
Definition at line 41 of file fl_standard_method_codec_test.cc.
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 | ( | buffer | , |
& | type, | ||
sizeof(uint8_t) | |||
) |
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.
G_DEFINE_TYPE | ( | FlTestMethodMessageCodec | , |
fl_test_method_message_codec | , | ||
fl_standard_message_codec_get_type() | |||
) |
|
static |
Definition at line 56 of file fl_standard_method_codec_test.cc.
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 | ( | FlStandardMethodCodecTest | , |
CustomMessageCodec | |||
) |
Definition at line 482 of file fl_standard_method_codec_test.cc.
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, result, and value.
TEST | ( | FlStandardMethodCodecTest | , |
DecodeMethodCallListArgs | |||
) |
Definition at line 294 of file fl_standard_method_codec_test.cc.
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, and FL_VALUE_TYPE_STRING.
TEST | ( | FlStandardMethodCodecTest | , |
DecodeMethodCallMissingArgs | |||
) |
Definition at line 322 of file fl_standard_method_codec_test.cc.
References decode_error_method_call(), FL_MESSAGE_CODEC_ERROR, and FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA.
TEST | ( | FlStandardMethodCodecTest | , |
DecodeMethodCallNoData | |||
) |
Definition at line 312 of file fl_standard_method_codec_test.cc.
References decode_error_method_call(), FL_MESSAGE_CODEC_ERROR, and FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA.
TEST | ( | FlStandardMethodCodecTest | , |
DecodeMethodCallNullArgs | |||
) |
Definition at line 277 of file fl_standard_method_codec_test.cc.
References args, decode_method_call(), fl_value_get_type(), and FL_VALUE_TYPE_NULL.
TEST | ( | FlStandardMethodCodecTest | , |
DecodeMethodCallNullMethodName | |||
) |
Definition at line 317 of file fl_standard_method_codec_test.cc.
References decode_error_method_call(), FL_MESSAGE_CODEC_ERROR, and FL_MESSAGE_CODEC_ERROR_FAILED.
TEST | ( | FlStandardMethodCodecTest | , |
DecodeMethodCallStringArgs | |||
) |
Definition at line 285 of file fl_standard_method_codec_test.cc.
References args, decode_method_call(), fl_value_get_string(), fl_value_get_type(), and FL_VALUE_TYPE_STRING.
TEST | ( | FlStandardMethodCodecTest | , |
DecodeResponseErrorDetails | |||
) |
Definition at line 419 of file fl_standard_method_codec_test.cc.
References decode_response_with_error(), fl_value_append_take(), fl_value_new_int(), fl_value_new_list(), and fl_value_new_string().
TEST | ( | FlStandardMethodCodecTest | , |
DecodeResponseErrorEmptyCode | |||
) |
Definition at line 406 of file fl_standard_method_codec_test.cc.
References decode_response_with_error().
TEST | ( | FlStandardMethodCodecTest | , |
DecodeResponseErrorExtraData | |||
) |
Definition at line 461 of file fl_standard_method_codec_test.cc.
References decode_error_response(), FL_MESSAGE_CODEC_ERROR, and FL_MESSAGE_CODEC_ERROR_FAILED.
TEST | ( | FlStandardMethodCodecTest | , |
DecodeResponseErrorMessage | |||
) |
Definition at line 414 of file fl_standard_method_codec_test.cc.
References decode_response_with_error().
TEST | ( | FlStandardMethodCodecTest | , |
DecodeResponseErrorMessageAndDetails | |||
) |
Definition at line 427 of file fl_standard_method_codec_test.cc.
References decode_response_with_error(), fl_value_append_take(), fl_value_new_int(), fl_value_new_list(), and fl_value_new_string().
TEST | ( | FlStandardMethodCodecTest | , |
DecodeResponseErrorMissingDetails | |||
) |
Definition at line 456 of file fl_standard_method_codec_test.cc.
References decode_error_response(), FL_MESSAGE_CODEC_ERROR, and FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA.
TEST | ( | FlStandardMethodCodecTest | , |
DecodeResponseErrorMissingMessageAndDetails | |||
) |
Definition at line 451 of file fl_standard_method_codec_test.cc.
References decode_error_response(), FL_MESSAGE_CODEC_ERROR, and FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA.
TEST | ( | FlStandardMethodCodecTest | , |
DecodeResponseErrorNoData | |||
) |
Definition at line 446 of file fl_standard_method_codec_test.cc.
References decode_error_response(), FL_MESSAGE_CODEC_ERROR, and FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA.
TEST | ( | FlStandardMethodCodecTest | , |
DecodeResponseErrorNoMessageOrDetails | |||
) |
Definition at line 410 of file fl_standard_method_codec_test.cc.
References decode_response_with_error().
TEST | ( | FlStandardMethodCodecTest | , |
DecodeResponseNotImplemented | |||
) |
Definition at line 466 of file fl_standard_method_codec_test.cc.
References error, fl_method_codec_decode_response(), and fl_standard_method_codec_new().
TEST | ( | FlStandardMethodCodecTest | , |
DecodeResponseSuccessExtraData | |||
) |
Definition at line 441 of file fl_standard_method_codec_test.cc.
References decode_error_response(), FL_MESSAGE_CODEC_ERROR, and FL_MESSAGE_CODEC_ERROR_FAILED.
TEST | ( | FlStandardMethodCodecTest | , |
DecodeResponseSuccessList | |||
) |
Definition at line 399 of file fl_standard_method_codec_test.cc.
References decode_response_with_success(), fl_value_append_take(), fl_value_new_int(), fl_value_new_list(), fl_value_new_string(), and result.
TEST | ( | FlStandardMethodCodecTest | , |
DecodeResponseSuccessNoData | |||
) |
Definition at line 436 of file fl_standard_method_codec_test.cc.
References decode_error_response(), FL_MESSAGE_CODEC_ERROR, and FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA.
TEST | ( | FlStandardMethodCodecTest | , |
DecodeResponseSuccessNull | |||
) |
Definition at line 389 of file fl_standard_method_codec_test.cc.
References decode_response_with_success(), fl_value_new_null(), and result.
TEST | ( | FlStandardMethodCodecTest | , |
DecodeResponseSuccessString | |||
) |
Definition at line 394 of file fl_standard_method_codec_test.cc.
References decode_response_with_success(), fl_value_new_string(), and result.
TEST | ( | FlStandardMethodCodecTest | , |
DecodeResponseUnknownEnvelope | |||
) |
Definition at line 477 of file fl_standard_method_codec_test.cc.
References decode_error_response(), FL_MESSAGE_CODEC_ERROR, and FL_MESSAGE_CODEC_ERROR_FAILED.
TEST | ( | FlStandardMethodCodecTest | , |
EncodeErrorEnvelopeDetails | |||
) |
Definition at line 369 of file fl_standard_method_codec_test.cc.
References encode_error_envelope(), fl_value_append_take(), fl_value_new_int(), fl_value_new_list(), and fl_value_new_string().
TEST | ( | FlStandardMethodCodecTest | , |
EncodeErrorEnvelopeEmptyCode | |||
) |
Definition at line 352 of file fl_standard_method_codec_test.cc.
References encode_error_envelope().
TEST | ( | FlStandardMethodCodecTest | , |
EncodeErrorEnvelopeMessage | |||
) |
Definition at line 363 of file fl_standard_method_codec_test.cc.
References encode_error_envelope().
TEST | ( | FlStandardMethodCodecTest | , |
EncodeErrorEnvelopeMessageAndDetails | |||
) |
Definition at line 378 of file fl_standard_method_codec_test.cc.
References encode_error_envelope(), fl_value_append_take(), fl_value_new_int(), fl_value_new_list(), and fl_value_new_string().
TEST | ( | FlStandardMethodCodecTest | , |
EncodeErrorEnvelopeNonMessageOrDetails | |||
) |
Definition at line 357 of file fl_standard_method_codec_test.cc.
References encode_error_envelope().
TEST | ( | FlStandardMethodCodecTest | , |
EncodeMethodCallListArgs | |||
) |
Definition at line 269 of file fl_standard_method_codec_test.cc.
References args, encode_method_call(), fl_value_append_take(), fl_value_new_int(), fl_value_new_list(), and fl_value_new_string().
TEST | ( | FlStandardMethodCodecTest | , |
EncodeMethodCallNullArgs | |||
) |
Definition at line 257 of file fl_standard_method_codec_test.cc.
References encode_method_call(), fl_value_new_null(), and value.
TEST | ( | FlStandardMethodCodecTest | , |
EncodeMethodCallNullptrArgs | |||
) |
TEST | ( | FlStandardMethodCodecTest | , |
EncodeMethodCallStringArgs | |||
) |
Definition at line 263 of file fl_standard_method_codec_test.cc.
References args, encode_method_call(), and fl_value_new_string().
TEST | ( | FlStandardMethodCodecTest | , |
EncodeSuccessEnvelopeList | |||
) |
Definition at line 344 of file fl_standard_method_codec_test.cc.
References encode_success_envelope(), fl_value_append_take(), fl_value_new_int(), fl_value_new_list(), fl_value_new_string(), and result.
TEST | ( | FlStandardMethodCodecTest | , |
EncodeSuccessEnvelopeNull | |||
) |
Definition at line 332 of file fl_standard_method_codec_test.cc.
References encode_success_envelope(), fl_value_new_null(), and result.
TEST | ( | FlStandardMethodCodecTest | , |
EncodeSuccessEnvelopeNullptr | |||
) |
Definition at line 327 of file fl_standard_method_codec_test.cc.
References encode_success_envelope().
TEST | ( | FlStandardMethodCodecTest | , |
EncodeSuccessEnvelopeString | |||
) |
Definition at line 338 of file fl_standard_method_codec_test.cc.
References encode_success_envelope(), fl_value_new_string(), and result.
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().
GByteArray FlValue GError** error |
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().
size_t length = strlen(text) |
Definition at line 32 of file fl_standard_method_codec_test.cc.
Referenced by read_custom_value().
return TRUE |
Definition at line 38 of file fl_standard_method_codec_test.cc.
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().
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().