#include "gtest/gtest.h"
#include <pthread.h>
#include <cstring>
#include "flutter/shell/platform/embedder/embedder.h"
#include "flutter/shell/platform/embedder/test_utils/proc_table_replacement.h"
#include "flutter/shell/platform/linux/fl_binary_messenger_private.h"
#include "flutter/shell/platform/linux/fl_engine_private.h"
#include "flutter/shell/platform/linux/public/flutter_linux/fl_binary_messenger.h"
#include "flutter/shell/platform/linux/public/flutter_linux/fl_method_channel.h"
#include "flutter/shell/platform/linux/public/flutter_linux/fl_standard_method_codec.h"
#include "flutter/shell/platform/linux/testing/fl_test.h"
#include "flutter/shell/platform/linux/testing/mock_binary_messenger_response_handle.h"
#include "flutter/shell/platform/linux/testing/mock_renderer.h"
Go to the source code of this file.
Classes | |
struct | RespondsOnBackgroundThreadInfo |
Functions | |
G_DECLARE_FINAL_TYPE (FlFakeBinaryMessenger, fl_fake_binary_messenger, FL, FAKE_BINARY_MESSENGER, GObject) struct _FlFakeBinaryMessenger | |
static void | fl_fake_binary_messenger_iface_init (FlBinaryMessengerInterface *iface) |
G_DEFINE_TYPE_WITH_CODE (FlFakeBinaryMessenger, fl_fake_binary_messenger, G_TYPE_OBJECT, G_IMPLEMENT_INTERFACE(fl_binary_messenger_get_type(), fl_fake_binary_messenger_iface_init)) static void fl_fake_binary_messenger_class_init(FlFakeBinaryMessengerClass *klass) | |
static gboolean | send_message_cb (gpointer user_data) |
static void | set_message_handler_on_channel (FlBinaryMessenger *messenger, const gchar *channel, FlBinaryMessengerMessageHandler handler, gpointer user_data, GDestroyNotify destroy_notify) |
static gboolean | send_response (FlBinaryMessenger *messenger, FlBinaryMessengerResponseHandle *response_handle, GBytes *response, GError **error) |
static gboolean | send_ready_cb (gpointer user_data) |
static void | send_on_channel (FlBinaryMessenger *messenger, const gchar *channel, GBytes *message, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data) |
static GBytes * | send_on_channel_finish (FlBinaryMessenger *messenger, GAsyncResult *result, GError **error) |
static void | resize_channel (FlBinaryMessenger *messenger, const gchar *channel, int64_t new_size) |
static void | set_warns_on_channel_overflow (FlBinaryMessenger *messenger, const gchar *channel, bool warns) |
static void | fl_fake_binary_messenger_init (FlFakeBinaryMessenger *self) |
static FlBinaryMessenger * | fl_fake_binary_messenger_new (GMainLoop *loop) |
static void | fake_response_cb (GObject *object, GAsyncResult *result, gpointer user_data) |
TEST (FlBinaryMessengerTest, FakeMessengerSend) | |
static void | fake_message_cb (FlBinaryMessenger *messenger, const gchar *channel, GBytes *message, FlBinaryMessengerResponseHandle *response_handle, gpointer user_data) |
TEST (FlBinaryMessengerTest, FakeMessengerReceive) | |
TEST (FlBinaryMessengerTest, SendNullptrMessage) | |
TEST (FlBinaryMessengerTest, SendEmptyMessage) | |
static void | echo_response_cb (GObject *object, GAsyncResult *result, gpointer user_data) |
TEST (FlBinaryMessengerTest, SendMessage) | |
static void | nullptr_response_cb (GObject *object, GAsyncResult *result, gpointer user_data) |
TEST (FlBinaryMessengerTest, NullptrResponse) | |
static void | failure_response_cb (GObject *object, GAsyncResult *result, gpointer user_data) |
TEST (FlBinaryMessengerTest, SendFailure) | |
static void | message_cb (FlBinaryMessenger *messenger, const gchar *channel, GBytes *message, FlBinaryMessengerResponseHandle *response_handle, gpointer user_data) |
static void | response_cb (FlBinaryMessenger *messenger, const gchar *channel, GBytes *message, FlBinaryMessengerResponseHandle *response_handle, gpointer user_data) |
TEST (FlBinaryMessengerTest, ReceiveMessage) | |
TEST (FlBinaryMessengerTest, ResizeChannel) | |
TEST (FlBinaryMessengerTest, WarnsOnOverflowChannel) | |
static gboolean | quit_main_loop_cb (gpointer user_data) |
TEST (FlBinaryMessengerTest, ControlChannelErrorResponse) | |
static gboolean | cleanup_responds_on_background_thread_info (gpointer user_data) |
static void * | response_from_thread_main (void *user_data) |
static void | response_from_thread_cb (FlBinaryMessenger *messenger, const gchar *channel, GBytes *message, FlBinaryMessengerResponseHandle *response_handle, gpointer user_data) |
TEST (FlBinaryMessengerTest, RespondOnBackgroundThread) | |
static void | kill_handler_notify_cb (gpointer was_called) |
TEST (FlBinaryMessengerTest, DeletingEngineClearsHandlers) | |
|
static |
Definition at line 562 of file fl_binary_messenger_test.cc.
References RespondsOnBackgroundThreadInfo::loop, RespondsOnBackgroundThreadInfo::messenger, RespondsOnBackgroundThreadInfo::response_handle, and user_data.
Referenced by response_from_thread_main().
|
static |
Definition at line 253 of file fl_binary_messenger_test.cc.
References error, fl_binary_messenger_send_on_channel_finish(), result, and user_data.
Referenced by TEST().
|
static |
Definition at line 317 of file fl_binary_messenger_test.cc.
References error, fl_binary_messenger_send_on_channel_finish(), result, and user_data.
Referenced by TEST().
|
static |
Definition at line 199 of file fl_binary_messenger_test.cc.
References error, and fl_binary_messenger_send_response().
Referenced by TEST().
|
static |
Definition at line 165 of file fl_binary_messenger_test.cc.
References error, fl_binary_messenger_send_on_channel_finish(), result, and user_data.
Referenced by TEST().
|
static |
Definition at line 145 of file fl_binary_messenger_test.cc.
References resize_channel(), send_on_channel(), send_on_channel_finish(), send_response(), set_message_handler_on_channel(), and set_warns_on_channel_overflow().
|
static |
Definition at line 155 of file fl_binary_messenger_test.cc.
|
static |
G_DECLARE_FINAL_TYPE | ( | FlFakeBinaryMessenger | , |
fl_fake_binary_messenger | , | ||
FL | , | ||
FAKE_BINARY_MESSENGER | , | ||
GObject | |||
) |
Definition at line 22 of file fl_binary_messenger_test.cc.
References FlBinaryMessengerMessageHandler.
G_DEFINE_TYPE_WITH_CODE | ( | FlFakeBinaryMessenger | , |
fl_fake_binary_messenger | , | ||
G_TYPE_OBJECT | , | ||
G_IMPLEMENT_INTERFACE(fl_binary_messenger_get_type(), fl_fake_binary_messenger_iface_init) | |||
) |
Definition at line 41 of file fl_binary_messenger_test.cc.
|
static |
|
static |
Definition at line 343 of file fl_binary_messenger_test.cc.
References error, and fl_binary_messenger_send_response().
Referenced by TEST().
|
static |
Definition at line 286 of file fl_binary_messenger_test.cc.
References error, fl_binary_messenger_send_on_channel_finish(), result, and user_data.
Referenced by TEST().
|
static |
Definition at line 504 of file fl_binary_messenger_test.cc.
References user_data.
Referenced by TEST().
|
static |
Definition at line 133 of file fl_binary_messenger_test.cc.
Referenced by fl_fake_binary_messenger_iface_init().
|
static |
Definition at line 365 of file fl_binary_messenger_test.cc.
References fl_binary_messenger_send_response(), and user_data.
Referenced by TEST().
|
static |
Definition at line 588 of file fl_binary_messenger_test.cc.
References RespondsOnBackgroundThreadInfo::loop, RespondsOnBackgroundThreadInfo::messenger, response_from_thread_main(), RespondsOnBackgroundThreadInfo::response_handle, and user_data.
Referenced by TEST().
|
static |
Definition at line 576 of file fl_binary_messenger_test.cc.
References cleanup_responds_on_background_thread_info(), fl_binary_messenger_send_response(), RespondsOnBackgroundThreadInfo::messenger, RespondsOnBackgroundThreadInfo::response_handle, and user_data.
Referenced by response_from_thread_cb().
|
static |
Definition at line 51 of file fl_binary_messenger_test.cc.
References user_data.
Referenced by set_message_handler_on_channel().
|
static |
Definition at line 106 of file fl_binary_messenger_test.cc.
References callback, send_ready_cb(), and user_data.
Referenced by fl_fake_binary_messenger_iface_init().
|
static |
Definition at line 126 of file fl_binary_messenger_test.cc.
Referenced by fl_fake_binary_messenger_iface_init().
|
static |
Definition at line 98 of file fl_binary_messenger_test.cc.
References user_data.
Referenced by send_on_channel().
|
static |
Definition at line 80 of file fl_binary_messenger_test.cc.
References TRUE.
Referenced by fl_fake_binary_messenger_iface_init().
|
static |
Definition at line 64 of file fl_binary_messenger_test.cc.
References send_message_cb(), and user_data.
Referenced by fl_fake_binary_messenger_iface_init().
|
static |
Definition at line 139 of file fl_binary_messenger_test.cc.
Referenced by fl_fake_binary_messenger_iface_init().
TEST | ( | FlBinaryMessengerTest | , |
ControlChannelErrorResponse | |||
) |
Definition at line 511 of file fl_binary_messenger_test.cc.
References error, fl_binary_messenger_new(), fl_binary_messenger_set_warns_on_channel_overflow(), fl_engine_get_embedder_api(), fl_engine_start(), make_mock_engine(), and quit_main_loop_cb().
TEST | ( | FlBinaryMessengerTest | , |
DeletingEngineClearsHandlers | |||
) |
Definition at line 635 of file fl_binary_messenger_test.cc.
References fl_binary_messenger_set_message_handler_on_channel(), fl_engine_get_binary_messenger(), kill_handler_notify_cb(), make_mock_engine(), and message_cb().
TEST | ( | FlBinaryMessengerTest | , |
FakeMessengerReceive | |||
) |
Definition at line 222 of file fl_binary_messenger_test.cc.
References fake_message_cb(), fl_binary_messenger_set_message_handler_on_channel(), and fl_fake_binary_messenger_new().
TEST | ( | FlBinaryMessengerTest | , |
FakeMessengerSend | |||
) |
Definition at line 183 of file fl_binary_messenger_test.cc.
References fake_response_cb(), fl_binary_messenger_send_on_channel(), and fl_fake_binary_messenger_new().
TEST | ( | FlBinaryMessengerTest | , |
NullptrResponse | |||
) |
Definition at line 301 of file fl_binary_messenger_test.cc.
References fl_binary_messenger_new(), fl_binary_messenger_send_on_channel(), make_mock_engine(), and nullptr_response_cb().
TEST | ( | FlBinaryMessengerTest | , |
ReceiveMessage | |||
) |
Definition at line 383 of file fl_binary_messenger_test.cc.
References fl_binary_messenger_new(), fl_binary_messenger_send_on_channel(), fl_binary_messenger_set_message_handler_on_channel(), make_mock_engine(), message_cb(), and response_cb().
TEST | ( | FlBinaryMessengerTest | , |
ResizeChannel | |||
) |
Definition at line 411 of file fl_binary_messenger_test.cc.
References error, fl_binary_messenger_new(), fl_binary_messenger_resize_channel(), fl_engine_get_embedder_api(), fl_engine_start(), i, and make_mock_engine().
TEST | ( | FlBinaryMessengerTest | , |
RespondOnBackgroundThread | |||
) |
Definition at line 607 of file fl_binary_messenger_test.cc.
References fl_binary_messenger_new(), fl_binary_messenger_send_on_channel(), fl_binary_messenger_set_message_handler_on_channel(), make_mock_engine(), message_cb(), and response_from_thread_cb().
TEST | ( | FlBinaryMessengerTest | , |
SendEmptyMessage | |||
) |
Definition at line 244 of file fl_binary_messenger_test.cc.
References fl_binary_messenger_new(), fl_binary_messenger_send_on_channel(), and make_mock_engine().
TEST | ( | FlBinaryMessengerTest | , |
SendFailure | |||
) |
Definition at line 330 of file fl_binary_messenger_test.cc.
References failure_response_cb(), fl_binary_messenger_new(), fl_binary_messenger_send_on_channel(), and make_mock_engine().
TEST | ( | FlBinaryMessengerTest | , |
SendMessage | |||
) |
Definition at line 271 of file fl_binary_messenger_test.cc.
References echo_response_cb(), fl_binary_messenger_new(), fl_binary_messenger_send_on_channel(), and make_mock_engine().
TEST | ( | FlBinaryMessengerTest | , |
SendNullptrMessage | |||
) |
Definition at line 236 of file fl_binary_messenger_test.cc.
References fl_binary_messenger_new(), fl_binary_messenger_send_on_channel(), and make_mock_engine().
TEST | ( | FlBinaryMessengerTest | , |
WarnsOnOverflowChannel | |||
) |
Definition at line 458 of file fl_binary_messenger_test.cc.
References error, fl_binary_messenger_new(), fl_binary_messenger_set_warns_on_channel_overflow(), fl_engine_get_embedder_api(), fl_engine_start(), i, and make_mock_engine().