Flutter Engine
The Flutter Engine
Public Member Functions | List of all members
flutter::testing::MockBinaryMessenger Class Reference

#include <mock_binary_messenger.h>

Public Member Functions

 MockBinaryMessenger ()
 
 ~MockBinaryMessenger ()
 
 operator FlBinaryMessenger * ()
 
 MOCK_METHOD (void, fl_binary_messenger_set_message_handler_on_channel,(FlBinaryMessenger *messenger, const gchar *channel, FlBinaryMessengerMessageHandler handler, gpointer user_data, GDestroyNotify destroy_notify))
 
 MOCK_METHOD (gboolean, fl_binary_messenger_send_response,(FlBinaryMessenger *messenger, FlBinaryMessengerResponseHandle *response_handle, GBytes *response, GError **error))
 
 MOCK_METHOD (void, fl_binary_messenger_send_on_channel,(FlBinaryMessenger *messenger, const gchar *channel, GBytes *message, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data))
 
 MOCK_METHOD (GBytes *, fl_binary_messenger_send_on_channel_finish,(FlBinaryMessenger *messenger, GAsyncResult *result, GError **error))
 
 MOCK_METHOD (void, fl_binary_messenger_resize_channel,(FlBinaryMessenger *messenger, const gchar *channel, int64_t new_size))
 
 MOCK_METHOD (void, fl_binary_messenger_set_warns_on_channel_overflow,(FlBinaryMessenger *messenger, const gchar *channel, bool warns))
 
bool HasMessageHandler (const gchar *channel) const
 
void SetMessageHandler (const gchar *channel, FlBinaryMessengerMessageHandler handler, gpointer user_data)
 
void ReceiveMessage (const gchar *channel, GBytes *message)
 

Detailed Description

Definition at line 18 of file mock_binary_messenger.h.

Constructor & Destructor Documentation

◆ MockBinaryMessenger()

MockBinaryMessenger::MockBinaryMessenger ( )

Definition at line 29 of file mock_binary_messenger.cc.

30 : instance_(fl_mock_binary_messenger_new(this)) {}
static FlBinaryMessenger * fl_mock_binary_messenger_new(MockBinaryMessenger *mock)

◆ ~MockBinaryMessenger()

MockBinaryMessenger::~MockBinaryMessenger ( )

Definition at line 32 of file mock_binary_messenger.cc.

32 {
33 if (FL_IS_BINARY_MESSENGER(instance_)) {
34 g_clear_object(&instance_);
35 }
36}

Member Function Documentation

◆ HasMessageHandler()

bool MockBinaryMessenger::HasMessageHandler ( const gchar *  channel) const

Definition at line 42 of file mock_binary_messenger.cc.

42 {
43 return message_handlers_.at(channel) != nullptr;
44}

◆ MOCK_METHOD() [1/6]

flutter::testing::MockBinaryMessenger::MOCK_METHOD ( gboolean  ,
fl_binary_messenger_send_response  ,
(FlBinaryMessenger *messenger, FlBinaryMessengerResponseHandle *response_handle, GBytes *response, GError **error  
)

◆ MOCK_METHOD() [2/6]

flutter::testing::MockBinaryMessenger::MOCK_METHOD ( GBytes *  ,
fl_binary_messenger_send_on_channel_finish  ,
(FlBinaryMessenger *messenger, GAsyncResult *result, GError **error  
)

◆ MOCK_METHOD() [3/6]

flutter::testing::MockBinaryMessenger::MOCK_METHOD ( void  ,
fl_binary_messenger_resize_channel  ,
(FlBinaryMessenger *messenger, const gchar *channel, int64_t new_size)   
)

◆ MOCK_METHOD() [4/6]

flutter::testing::MockBinaryMessenger::MOCK_METHOD ( void  ,
fl_binary_messenger_send_on_channel  ,
(FlBinaryMessenger *messenger, const gchar *channel, GBytes *message, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data  
)

◆ MOCK_METHOD() [5/6]

flutter::testing::MockBinaryMessenger::MOCK_METHOD ( void  ,
fl_binary_messenger_set_message_handler_on_channel  ,
(FlBinaryMessenger *messenger, const gchar *channel, FlBinaryMessengerMessageHandler handler, gpointer user_data, GDestroyNotify destroy_notify)   
)

◆ MOCK_METHOD() [6/6]

flutter::testing::MockBinaryMessenger::MOCK_METHOD ( void  ,
fl_binary_messenger_set_warns_on_channel_overflow  ,
(FlBinaryMessenger *messenger, const gchar *channel, bool warns)   
)

◆ operator FlBinaryMessenger *()

MockBinaryMessenger::operator FlBinaryMessenger * ( )

Definition at line 38 of file mock_binary_messenger.cc.

38 {
39 return instance_;
40}

◆ ReceiveMessage()

void MockBinaryMessenger::ReceiveMessage ( const gchar *  channel,
GBytes *  message 
)

Definition at line 54 of file mock_binary_messenger.cc.

55 {
56 FlBinaryMessengerMessageHandler handler = message_handlers_[channel];
57 if (response_handles_[channel] == nullptr) {
58 response_handles_[channel] = FL_BINARY_MESSENGER_RESPONSE_HANDLE(
60 }
61 handler(instance_, channel, message, response_handles_[channel],
62 user_datas_[channel]);
63}
G_MODULE_EXPORT GObject typedef void(* FlBinaryMessengerMessageHandler)(FlBinaryMessenger *messenger, const gchar *channel, GBytes *message, FlBinaryMessengerResponseHandle *response_handle, gpointer user_data)
Win32Message message
FlMockBinaryMessengerResponseHandle * fl_mock_binary_messenger_response_handle_new()

◆ SetMessageHandler()

void MockBinaryMessenger::SetMessageHandler ( const gchar *  channel,
FlBinaryMessengerMessageHandler  handler,
gpointer  user_data 
)

Definition at line 46 of file mock_binary_messenger.cc.

49 {
50 message_handlers_[channel] = handler;
51 user_datas_[channel] = user_data;
52}
void * user_data

The documentation for this class was generated from the following files: