Flutter Linux Embedder
fl_method_channel_test.cc File Reference

Go to the source code of this file.

Classes

struct  UserDataReassignMethod
 

Functions

static void method_response_cb (GObject *object, GAsyncResult *result, gpointer user_data)
 
 TEST (FlMethodChannelTest, InvokeMethod)
 
static void nullptr_args_response_cb (GObject *object, GAsyncResult *result, gpointer user_data)
 
 TEST (FlMethodChannelTest, InvokeMethodNullptrArgsMessage)
 
static void error_response_cb (GObject *object, GAsyncResult *result, gpointer user_data)
 
 TEST (FlMethodChannelTest, InvokeMethodError)
 
static void not_implemented_response_cb (GObject *object, GAsyncResult *result, gpointer user_data)
 
 TEST (FlMethodChannelTest, InvokeMethodNotImplemented)
 
static void failure_response_cb (GObject *object, GAsyncResult *result, gpointer user_data)
 
 TEST (FlMethodChannelTest, InvokeMethodFailure)
 
static void method_call_success_cb (FlMethodChannel *channel, FlMethodCall *method_call, gpointer user_data)
 
static void method_call_success_response_cb (FlBinaryMessenger *messenger, const gchar *channel, GBytes *message, FlBinaryMessengerResponseHandle *response_handle, gpointer user_data)
 
 TEST (FlMethodChannelTest, ReceiveMethodCallRespondSuccess)
 
static void method_call_error_cb (FlMethodChannel *channel, FlMethodCall *method_call, gpointer user_data)
 
static void method_call_error_response_cb (FlBinaryMessenger *messenger, const gchar *channel, GBytes *message, FlBinaryMessengerResponseHandle *response_handle, gpointer user_data)
 
 TEST (FlMethodChannelTest, ReceiveMethodCallRespondError)
 
static void method_call_not_implemented_cb (FlMethodChannel *channel, FlMethodCall *method_call, gpointer user_data)
 
static void method_call_not_implemented_response_cb (FlBinaryMessenger *messenger, const gchar *channel, GBytes *message, FlBinaryMessengerResponseHandle *response_handle, gpointer user_data)
 
 TEST (FlMethodChannelTest, ReceiveMethodCallRespondNotImplemented)
 
 G_DECLARE_FINAL_TYPE (TestMethodCodec, test_method_codec, TEST, METHOD_CODEC, FlMethodCodec) struct _TestMethodCodec
 
static void test_method_codec_dispose (GObject *object)
 
static GBytes * test_method_codec_encode_method_call (FlMethodCodec *codec, const gchar *name, FlValue *args, GError **error)
 
static gboolean test_method_codec_decode_method_call (FlMethodCodec *codec, GBytes *message, gchar **name, FlValue **args, GError **error)
 
static GBytes * test_method_codec_encode_success_envelope (FlMethodCodec *codec, FlValue *result, GError **error)
 
static GBytes * test_method_codec_encode_error_envelope (FlMethodCodec *codec, const gchar *code, const gchar *message, FlValue *details, GError **error)
 
static FlMethodResponse * test_method_codec_decode_response (FlMethodCodec *codec, GBytes *message, GError **error)
 
static void test_method_codec_class_init (TestMethodCodecClass *klass)
 
static void test_method_codec_init (TestMethodCodec *self)
 
TestMethodCodec * test_method_codec_new ()
 
static void method_call_success_error_cb (FlMethodChannel *channel, FlMethodCall *method_call, gpointer user_data)
 
 TEST (FlMethodChannelTest, ReceiveMethodCallRespondSuccessError)
 
static void method_call_error_error_cb (FlMethodChannel *channel, FlMethodCall *method_call, gpointer user_data)
 
 TEST (FlMethodChannelTest, ReceiveMethodCallRespondErrorError)
 
static void reassign_method_cb (FlMethodChannel *channel, FlMethodCall *method_call, gpointer raw_user_data)
 
 TEST (FlMethodChannelTest, ReplaceADisposedMethodChannel)
 
 TEST (FlMethodChannelTest, DisposeAReplacedMethodChannel)
 

Function Documentation

◆ error_response_cb()

static void error_response_cb ( GObject *  object,
GAsyncResult *  result,
gpointer  user_data 
)
static

Definition at line 94 of file fl_method_channel_test.cc.

96  {
97  g_autoptr(GError) error = nullptr;
98  g_autoptr(FlMethodResponse) response = fl_method_channel_invoke_method_finish(
99  FL_METHOD_CHANNEL(object), result, &error);
100  EXPECT_NE(response, nullptr);
101  EXPECT_EQ(error, nullptr);
102 
103  EXPECT_TRUE(FL_IS_METHOD_ERROR_RESPONSE(response));
104  EXPECT_STREQ(
105  fl_method_error_response_get_code(FL_METHOD_ERROR_RESPONSE(response)),
106  "CODE");
107  EXPECT_STREQ(
108  fl_method_error_response_get_message(FL_METHOD_ERROR_RESPONSE(response)),
109  "MESSAGE");
110  FlValue* details =
111  fl_method_error_response_get_details(FL_METHOD_ERROR_RESPONSE(response));
112  EXPECT_NE(details, nullptr);
113  EXPECT_EQ(fl_value_get_type(details), FL_VALUE_TYPE_STRING);
114  EXPECT_STREQ(fl_value_get_string(details), "DETAILS");
115 
116  g_main_loop_quit(static_cast<GMainLoop*>(user_data));
117 }

References error, fl_method_channel_invoke_method_finish(), fl_method_error_response_get_code(), fl_method_error_response_get_details(), fl_method_error_response_get_message(), fl_value_get_string(), fl_value_get_type(), FL_VALUE_TYPE_STRING, result, and user_data.

Referenced by TEST().

◆ failure_response_cb()

static void failure_response_cb ( GObject *  object,
GAsyncResult *  result,
gpointer  user_data 
)
static

Definition at line 175 of file fl_method_channel_test.cc.

177  {
178  g_autoptr(GError) error = nullptr;
179  g_autoptr(FlMethodResponse) response = fl_method_channel_invoke_method_finish(
180  FL_METHOD_CHANNEL(object), result, &error);
181  EXPECT_EQ(response, nullptr);
182  EXPECT_NE(error, nullptr);
183 
184  g_main_loop_quit(static_cast<GMainLoop*>(user_data));
185 }

References error, fl_method_channel_invoke_method_finish(), result, and user_data.

Referenced by TEST().

◆ G_DECLARE_FINAL_TYPE()

G_DECLARE_FINAL_TYPE ( TestMethodCodec  ,
test_method_codec  ,
TEST  ,
METHOD_CODEC  ,
FlMethodCodec   
)

Definition at line 426 of file fl_method_channel_test.cc.

432  {
433  FlMethodCodec parent_instance;
434 
435  FlStandardMethodCodec* wrapped_codec;
436 };

◆ method_call_error_cb()

static void method_call_error_cb ( FlMethodChannel *  channel,
FlMethodCall *  method_call,
gpointer  user_data 
)
static

Definition at line 279 of file fl_method_channel_test.cc.

281  {
282  EXPECT_STREQ(fl_method_call_get_name(method_call), "Foo");
286  "Marco!");
287 
288  g_autoptr(FlValue) details = fl_value_new_string("DETAILS");
289  g_autoptr(GError) error = nullptr;
290  EXPECT_TRUE(fl_method_call_respond_error(method_call, "CODE", "MESSAGE",
291  details, &error));
292  EXPECT_EQ(error, nullptr);
293 }

References error, fl_method_call_get_args(), fl_method_call_get_name(), fl_method_call_respond_error(), fl_value_get_string(), fl_value_get_type(), fl_value_new_string(), FL_VALUE_TYPE_STRING, and method_call.

Referenced by TEST().

◆ method_call_error_error_cb()

static void method_call_error_error_cb ( FlMethodChannel *  channel,
FlMethodCall *  method_call,
gpointer  user_data 
)
static

Definition at line 567 of file fl_method_channel_test.cc.

569  {
570  g_autoptr(FlValue) details = fl_value_new_int(42);
571  g_autoptr(GError) response_error = nullptr;
572  EXPECT_FALSE(fl_method_call_respond_error(method_call, "error", "ERROR",
573  details, &response_error));
574  EXPECT_NE(response_error, nullptr);
575 
576  // Respond to stop a warning occurring about not responding.
578 
579  g_main_loop_quit(static_cast<GMainLoop*>(user_data));
580 }

References fl_method_call_respond_error(), fl_method_call_respond_not_implemented(), fl_value_new_int(), method_call, and user_data.

Referenced by TEST().

◆ method_call_error_response_cb()

static void method_call_error_response_cb ( FlBinaryMessenger *  messenger,
const gchar *  channel,
GBytes *  message,
FlBinaryMessengerResponseHandle *  response_handle,
gpointer  user_data 
)
static

Definition at line 297 of file fl_method_channel_test.cc.

302  {
303  g_autoptr(FlStandardMethodCodec) codec = fl_standard_method_codec_new();
304  g_autoptr(GError) error = nullptr;
305  g_autoptr(FlMethodResponse) response =
306  fl_method_codec_decode_response(FL_METHOD_CODEC(codec), message, &error);
307  EXPECT_NE(response, nullptr);
308  EXPECT_EQ(error, nullptr);
309 
310  EXPECT_TRUE(FL_IS_METHOD_ERROR_RESPONSE(response));
311  EXPECT_STREQ(
312  fl_method_error_response_get_code(FL_METHOD_ERROR_RESPONSE(response)),
313  "CODE");
314  EXPECT_STREQ(
315  fl_method_error_response_get_message(FL_METHOD_ERROR_RESPONSE(response)),
316  "MESSAGE");
317  FlValue* details =
318  fl_method_error_response_get_details(FL_METHOD_ERROR_RESPONSE(response));
319  EXPECT_EQ(fl_value_get_type(details), FL_VALUE_TYPE_STRING);
320  EXPECT_STREQ(fl_value_get_string(details), "DETAILS");
321 
322  fl_binary_messenger_send_response(messenger, response_handle, nullptr,
323  nullptr);
324 
325  g_main_loop_quit(static_cast<GMainLoop*>(user_data));
326 }

References error, fl_binary_messenger_send_response(), 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_get_string(), fl_value_get_type(), FL_VALUE_TYPE_STRING, and user_data.

Referenced by TEST().

◆ method_call_not_implemented_cb()

static void method_call_not_implemented_cb ( FlMethodChannel *  channel,
FlMethodCall *  method_call,
gpointer  user_data 
)
static

Definition at line 359 of file fl_method_channel_test.cc.

361  {
362  EXPECT_STREQ(fl_method_call_get_name(method_call), "Foo");
366  "Marco!");
367 
368  g_autoptr(GError) error = nullptr;
370  EXPECT_EQ(error, nullptr);
371 }

References error, fl_method_call_get_args(), fl_method_call_get_name(), fl_method_call_respond_not_implemented(), fl_value_get_string(), fl_value_get_type(), FL_VALUE_TYPE_STRING, and method_call.

Referenced by TEST().

◆ method_call_not_implemented_response_cb()

static void method_call_not_implemented_response_cb ( FlBinaryMessenger *  messenger,
const gchar *  channel,
GBytes *  message,
FlBinaryMessengerResponseHandle *  response_handle,
gpointer  user_data 
)
static

Definition at line 375 of file fl_method_channel_test.cc.

380  {
381  g_autoptr(FlStandardMethodCodec) codec = fl_standard_method_codec_new();
382  g_autoptr(GError) error = nullptr;
383  g_autoptr(FlMethodResponse) response =
384  fl_method_codec_decode_response(FL_METHOD_CODEC(codec), message, &error);
385  EXPECT_NE(response, nullptr);
386  EXPECT_EQ(error, nullptr);
387 
388  EXPECT_TRUE(FL_IS_METHOD_NOT_IMPLEMENTED_RESPONSE(response));
389 
390  fl_binary_messenger_send_response(messenger, response_handle, nullptr,
391  nullptr);
392 
393  g_main_loop_quit(static_cast<GMainLoop*>(user_data));
394 }

References error, fl_binary_messenger_send_response(), fl_method_codec_decode_response(), fl_standard_method_codec_new(), and user_data.

Referenced by TEST().

◆ method_call_success_cb()

static void method_call_success_cb ( FlMethodChannel *  channel,
FlMethodCall *  method_call,
gpointer  user_data 
)
static

Definition at line 206 of file fl_method_channel_test.cc.

208  {
209  EXPECT_STREQ(fl_method_call_get_name(method_call), "Foo");
213  "Marco!");
214 
215  g_autoptr(FlValue) result = fl_value_new_string("Polo!");
216  g_autoptr(GError) error = nullptr;
218  EXPECT_EQ(error, nullptr);
219 }

References error, fl_method_call_get_args(), fl_method_call_get_name(), fl_method_call_respond_success(), fl_value_get_string(), fl_value_get_type(), fl_value_new_string(), FL_VALUE_TYPE_STRING, method_call, and result.

Referenced by TEST().

◆ method_call_success_error_cb()

static void method_call_success_error_cb ( FlMethodChannel *  channel,
FlMethodCall *  method_call,
gpointer  user_data 
)
static

Definition at line 525 of file fl_method_channel_test.cc.

527  {
528  g_autoptr(FlValue) result = fl_value_new_int(42);
529  g_autoptr(GError) response_error = nullptr;
530  EXPECT_FALSE(
532  EXPECT_NE(response_error, nullptr);
533 
534  // Respond to stop a warning occurring about not responding.
536 
537  g_main_loop_quit(static_cast<GMainLoop*>(user_data));
538 }

References fl_method_call_respond_not_implemented(), fl_method_call_respond_success(), fl_value_new_int(), method_call, result, and user_data.

Referenced by TEST().

◆ method_call_success_response_cb()

static void method_call_success_response_cb ( FlBinaryMessenger *  messenger,
const gchar *  channel,
GBytes *  message,
FlBinaryMessengerResponseHandle *  response_handle,
gpointer  user_data 
)
static

Definition at line 223 of file fl_method_channel_test.cc.

228  {
229  g_autoptr(FlStandardMethodCodec) codec = fl_standard_method_codec_new();
230  g_autoptr(GError) error = nullptr;
231  g_autoptr(FlMethodResponse) response =
232  fl_method_codec_decode_response(FL_METHOD_CODEC(codec), message, &error);
233  EXPECT_NE(response, nullptr);
234  EXPECT_EQ(error, nullptr);
235 
236  EXPECT_TRUE(FL_IS_METHOD_SUCCESS_RESPONSE(response));
238  FL_METHOD_SUCCESS_RESPONSE(response));
240  EXPECT_STREQ(fl_value_get_string(result), "Polo!");
241 
242  fl_binary_messenger_send_response(messenger, response_handle, nullptr,
243  nullptr);
244 
245  g_main_loop_quit(static_cast<GMainLoop*>(user_data));
246 }

References error, fl_binary_messenger_send_response(), fl_method_codec_decode_response(), fl_method_success_response_get_result(), fl_standard_method_codec_new(), fl_value_get_string(), fl_value_get_type(), FL_VALUE_TYPE_STRING, result, and user_data.

Referenced by TEST().

◆ method_response_cb()

static void method_response_cb ( GObject *  object,
GAsyncResult *  result,
gpointer  user_data 
)
static

Definition at line 19 of file fl_method_channel_test.cc.

21  {
22  g_autoptr(GError) error = nullptr;
23  g_autoptr(FlMethodResponse) response = fl_method_channel_invoke_method_finish(
24  FL_METHOD_CHANNEL(object), result, &error);
25  EXPECT_NE(response, nullptr);
26  EXPECT_EQ(error, nullptr);
27 
29  EXPECT_NE(r, nullptr);
30  EXPECT_EQ(error, nullptr);
31 
33  EXPECT_STREQ(fl_value_get_string(r), "Hello World!");
34 
35  g_main_loop_quit(static_cast<GMainLoop*>(user_data));
36 }

References error, fl_method_channel_invoke_method_finish(), fl_method_response_get_result(), fl_value_get_string(), fl_value_get_type(), FL_VALUE_TYPE_STRING, result, and user_data.

Referenced by TEST().

◆ not_implemented_response_cb()

static void not_implemented_response_cb ( GObject *  object,
GAsyncResult *  result,
gpointer  user_data 
)
static

Definition at line 142 of file fl_method_channel_test.cc.

144  {
145  g_autoptr(GError) error = nullptr;
146  g_autoptr(FlMethodResponse) response = fl_method_channel_invoke_method_finish(
147  FL_METHOD_CHANNEL(object), result, &error);
148  EXPECT_NE(response, nullptr);
149  EXPECT_EQ(error, nullptr);
150 
151  EXPECT_TRUE(FL_IS_METHOD_NOT_IMPLEMENTED_RESPONSE(response));
152 
153  g_main_loop_quit(static_cast<GMainLoop*>(user_data));
154 }

References error, fl_method_channel_invoke_method_finish(), result, and user_data.

Referenced by TEST().

◆ nullptr_args_response_cb()

static void nullptr_args_response_cb ( GObject *  object,
GAsyncResult *  result,
gpointer  user_data 
)
static

Definition at line 58 of file fl_method_channel_test.cc.

60  {
61  g_autoptr(GError) error = nullptr;
62  g_autoptr(FlMethodResponse) response = fl_method_channel_invoke_method_finish(
63  FL_METHOD_CHANNEL(object), result, &error);
64  EXPECT_NE(response, nullptr);
65  EXPECT_EQ(error, nullptr);
66 
68  EXPECT_NE(r, nullptr);
69  EXPECT_EQ(error, nullptr);
71 
72  g_main_loop_quit(static_cast<GMainLoop*>(user_data));
73 }

References error, fl_method_channel_invoke_method_finish(), fl_method_response_get_result(), fl_value_get_type(), FL_VALUE_TYPE_NULL, result, and user_data.

Referenced by TEST().

◆ reassign_method_cb()

static void reassign_method_cb ( FlMethodChannel *  channel,
FlMethodCall *  method_call,
gpointer  raw_user_data 
)
static

Definition at line 614 of file fl_method_channel_test.cc.

616  {
618  static_cast<UserDataReassignMethod*>(raw_user_data);
619  user_data->count += 1;
620 
621  g_autoptr(FlValue) result = fl_value_new_string("Polo!");
622  g_autoptr(GError) error = nullptr;
624  EXPECT_EQ(error, nullptr);
625 
626  g_main_loop_quit(user_data->loop);
627 }

References error, fl_method_call_respond_success(), fl_value_new_string(), method_call, result, and user_data.

Referenced by TEST().

◆ TEST() [1/12]

TEST ( FlMethodChannelTest  ,
DisposeAReplacedMethodChannel   
)

Definition at line 693 of file fl_method_channel_test.cc.

693  {
694  const char* method_name = "test/standard-method";
695  // The loop is used to pause the main process until the callback is fully
696  // executed.
697  g_autoptr(GMainLoop) loop = g_main_loop_new(nullptr, 0);
698  g_autoptr(FlEngine) engine = make_mock_engine();
699  g_autoptr(FlBinaryMessenger) messenger = fl_binary_messenger_new(engine);
700  g_autoptr(FlStandardMethodCodec) codec = fl_standard_method_codec_new();
701 
702  g_autoptr(FlValue) args = fl_value_new_list();
706 
707  // Register the first channel and test if it works.
708  UserDataReassignMethod user_data1{
709  .loop = loop,
710  .count = 100,
711  };
712  FlMethodChannel* channel1 =
713  fl_method_channel_new(messenger, method_name, FL_METHOD_CODEC(codec));
715  &user_data1, nullptr);
716 
717  fl_method_channel_invoke_method(channel1, "InvokeMethod", args, nullptr,
718  nullptr, nullptr);
719  g_main_loop_run(loop);
720  EXPECT_EQ(user_data1.count, 101);
721 
722  // Register a new channel to the same name.
723  UserDataReassignMethod user_data2{
724  .loop = loop,
725  .count = 100,
726  };
727  g_autoptr(FlMethodChannel) channel2 =
728  fl_method_channel_new(messenger, method_name, FL_METHOD_CODEC(codec));
730  &user_data2, nullptr);
731 
732  fl_method_channel_invoke_method(channel2, "InvokeMethod", args, nullptr,
733  nullptr, nullptr);
734  g_main_loop_run(loop);
735  EXPECT_EQ(user_data1.count, 101);
736  EXPECT_EQ(user_data2.count, 101);
737 
738  // Dispose the first channel. The new channel should keep working.
739  g_object_unref(channel1);
740 
741  fl_method_channel_invoke_method(channel2, "InvokeMethod", args, nullptr,
742  nullptr, nullptr);
743  g_main_loop_run(loop);
744  EXPECT_EQ(user_data1.count, 101);
745  EXPECT_EQ(user_data2.count, 102);
746 }

References args, fl_binary_messenger_new(), fl_method_channel_invoke_method(), fl_method_channel_new(), fl_method_channel_set_method_call_handler(), fl_standard_method_codec_new(), fl_value_append_take(), fl_value_new_list(), fl_value_new_string(), UserDataReassignMethod::loop, make_mock_engine(), and reassign_method_cb().

◆ TEST() [2/12]

TEST ( FlMethodChannelTest  ,
InvokeMethod   
)

Definition at line 39 of file fl_method_channel_test.cc.

39  {
40  g_autoptr(GMainLoop) loop = g_main_loop_new(nullptr, 0);
41 
42  g_autoptr(FlEngine) engine = make_mock_engine();
43  g_autoptr(FlBinaryMessenger) messenger = fl_binary_messenger_new(engine);
44  g_autoptr(FlStandardMethodCodec) codec = fl_standard_method_codec_new();
45  g_autoptr(FlMethodChannel) channel = fl_method_channel_new(
46  messenger, "test/standard-method", FL_METHOD_CODEC(codec));
47 
48  g_autoptr(FlValue) args = fl_value_new_string("Hello World!");
49  fl_method_channel_invoke_method(channel, "Echo", args, nullptr,
50  method_response_cb, loop);
51 
52  // Blocks here until method_response_cb is called.
53  g_main_loop_run(loop);
54 }

References args, fl_binary_messenger_new(), fl_method_channel_invoke_method(), fl_method_channel_new(), fl_standard_method_codec_new(), fl_value_new_string(), make_mock_engine(), and method_response_cb().

◆ TEST() [3/12]

TEST ( FlMethodChannelTest  ,
InvokeMethodError   
)

Definition at line 120 of file fl_method_channel_test.cc.

120  {
121  g_autoptr(GMainLoop) loop = g_main_loop_new(nullptr, 0);
122 
123  g_autoptr(FlEngine) engine = make_mock_engine();
124  g_autoptr(FlBinaryMessenger) messenger = fl_binary_messenger_new(engine);
125  g_autoptr(FlStandardMethodCodec) codec = fl_standard_method_codec_new();
126  g_autoptr(FlMethodChannel) channel = fl_method_channel_new(
127  messenger, "test/standard-method", FL_METHOD_CODEC(codec));
128 
129  g_autoptr(FlValue) args = fl_value_new_list();
133  fl_method_channel_invoke_method(channel, "Error", args, nullptr,
134  error_response_cb, loop);
135 
136  // Blocks here until error_response_cb is called.
137  g_main_loop_run(loop);
138 }

References args, error_response_cb(), fl_binary_messenger_new(), fl_method_channel_invoke_method(), fl_method_channel_new(), fl_standard_method_codec_new(), fl_value_append_take(), fl_value_new_list(), fl_value_new_string(), and make_mock_engine().

◆ TEST() [4/12]

TEST ( FlMethodChannelTest  ,
InvokeMethodFailure   
)

Definition at line 188 of file fl_method_channel_test.cc.

188  {
189  g_autoptr(GMainLoop) loop = g_main_loop_new(nullptr, 0);
190 
191  g_autoptr(FlEngine) engine = make_mock_engine();
192  g_autoptr(FlBinaryMessenger) messenger = fl_binary_messenger_new(engine);
193  g_autoptr(FlStandardMethodCodec) codec = fl_standard_method_codec_new();
194  g_autoptr(FlMethodChannel) channel =
195  fl_method_channel_new(messenger, "test/failure", FL_METHOD_CODEC(codec));
196 
197  fl_method_channel_invoke_method(channel, "Echo", nullptr, nullptr,
198  failure_response_cb, loop);
199 
200  // Blocks here until failure_response_cb is called.
201  g_main_loop_run(loop);
202 }

References failure_response_cb(), fl_binary_messenger_new(), fl_method_channel_invoke_method(), fl_method_channel_new(), fl_standard_method_codec_new(), and make_mock_engine().

◆ TEST() [5/12]

TEST ( FlMethodChannelTest  ,
InvokeMethodNotImplemented   
)

Definition at line 157 of file fl_method_channel_test.cc.

157  {
158  g_autoptr(GMainLoop) loop = g_main_loop_new(nullptr, 0);
159 
160  g_autoptr(FlEngine) engine = make_mock_engine();
161  g_autoptr(FlBinaryMessenger) messenger = fl_binary_messenger_new(engine);
162  g_autoptr(FlStandardMethodCodec) codec = fl_standard_method_codec_new();
163  g_autoptr(FlMethodChannel) channel = fl_method_channel_new(
164  messenger, "test/standard-method", FL_METHOD_CODEC(codec));
165 
166  fl_method_channel_invoke_method(channel, "NotImplemented", nullptr, nullptr,
168 
169  // Blocks here until not_implemented_response_cb is called.
170  g_main_loop_run(loop);
171 }

References fl_binary_messenger_new(), fl_method_channel_invoke_method(), fl_method_channel_new(), fl_standard_method_codec_new(), make_mock_engine(), and not_implemented_response_cb().

◆ TEST() [6/12]

TEST ( FlMethodChannelTest  ,
InvokeMethodNullptrArgsMessage   
)

Definition at line 76 of file fl_method_channel_test.cc.

76  {
77  g_autoptr(GMainLoop) loop = g_main_loop_new(nullptr, 0);
78 
79  g_autoptr(FlEngine) engine = make_mock_engine();
80  g_autoptr(FlBinaryMessenger) messenger = fl_binary_messenger_new(engine);
81  g_autoptr(FlStandardMethodCodec) codec = fl_standard_method_codec_new();
82  g_autoptr(FlMethodChannel) channel = fl_method_channel_new(
83  messenger, "test/standard-method", FL_METHOD_CODEC(codec));
84 
85  fl_method_channel_invoke_method(channel, "Echo", nullptr, nullptr,
87 
88  // Blocks here until nullptr_args_response_cb is called.
89  g_main_loop_run(loop);
90 }

References fl_binary_messenger_new(), fl_method_channel_invoke_method(), fl_method_channel_new(), fl_standard_method_codec_new(), make_mock_engine(), and nullptr_args_response_cb().

◆ TEST() [7/12]

TEST ( FlMethodChannelTest  ,
ReceiveMethodCallRespondError   
)

Definition at line 329 of file fl_method_channel_test.cc.

329  {
330  g_autoptr(GMainLoop) loop = g_main_loop_new(nullptr, 0);
331 
332  g_autoptr(FlEngine) engine = make_mock_engine();
333  g_autoptr(FlBinaryMessenger) messenger = fl_binary_messenger_new(engine);
334  g_autoptr(FlStandardMethodCodec) codec = fl_standard_method_codec_new();
335  g_autoptr(FlMethodChannel) channel = fl_method_channel_new(
336  messenger, "test/standard-method", FL_METHOD_CODEC(codec));
338  nullptr, nullptr);
339 
340  // Listen for response from the engine.
342  messenger, "test/responses", method_call_error_response_cb, loop,
343  nullptr);
344 
345  // Trigger the engine to make a method call.
346  g_autoptr(FlValue) args = fl_value_new_list();
347  fl_value_append_take(args, fl_value_new_string("test/standard-method"));
350  fl_method_channel_invoke_method(channel, "InvokeMethod", args, nullptr,
351  nullptr, loop);
352 
353  // Blocks here until method_call_error_response_cb is called.
354  g_main_loop_run(loop);
355 }

References args, fl_binary_messenger_new(), fl_binary_messenger_set_message_handler_on_channel(), fl_method_channel_invoke_method(), fl_method_channel_new(), fl_method_channel_set_method_call_handler(), fl_standard_method_codec_new(), fl_value_append_take(), fl_value_new_list(), fl_value_new_string(), make_mock_engine(), method_call_error_cb(), and method_call_error_response_cb().

◆ TEST() [8/12]

TEST ( FlMethodChannelTest  ,
ReceiveMethodCallRespondErrorError   
)

Definition at line 584 of file fl_method_channel_test.cc.

584  {
585  g_autoptr(GMainLoop) loop = g_main_loop_new(nullptr, 0);
586 
587  g_autoptr(FlEngine) engine = make_mock_engine();
588  g_autoptr(FlBinaryMessenger) messenger = fl_binary_messenger_new(engine);
589  g_autoptr(TestMethodCodec) codec = test_method_codec_new();
590  g_autoptr(FlMethodChannel) channel = fl_method_channel_new(
591  messenger, "test/standard-method", FL_METHOD_CODEC(codec));
593  loop, nullptr);
594 
595  // Trigger the engine to make a method call.
596  g_autoptr(FlValue) args = fl_value_new_list();
597  fl_value_append_take(args, fl_value_new_string("test/standard-method"));
600  fl_method_channel_invoke_method(channel, "InvokeMethod", args, nullptr,
601  nullptr, loop);
602 
603  // Blocks here until method_call_error_error_cb is called.
604  g_main_loop_run(loop);
605 }

References args, fl_binary_messenger_new(), fl_method_channel_invoke_method(), fl_method_channel_new(), fl_method_channel_set_method_call_handler(), fl_value_append_take(), fl_value_new_list(), fl_value_new_string(), make_mock_engine(), method_call_error_error_cb(), and test_method_codec_new().

◆ TEST() [9/12]

TEST ( FlMethodChannelTest  ,
ReceiveMethodCallRespondNotImplemented   
)

Definition at line 397 of file fl_method_channel_test.cc.

397  {
398  g_autoptr(GMainLoop) loop = g_main_loop_new(nullptr, 0);
399 
400  g_autoptr(FlEngine) engine = make_mock_engine();
401  g_autoptr(FlBinaryMessenger) messenger = fl_binary_messenger_new(engine);
402  g_autoptr(FlStandardMethodCodec) codec = fl_standard_method_codec_new();
403  g_autoptr(FlMethodChannel) channel = fl_method_channel_new(
404  messenger, "test/standard-method", FL_METHOD_CODEC(codec));
406  channel, method_call_not_implemented_cb, nullptr, nullptr);
407 
408  // Listen for response from the engine.
410  messenger, "test/responses", method_call_not_implemented_response_cb,
411  loop, nullptr);
412 
413  // Trigger the engine to make a method call.
414  g_autoptr(FlValue) args = fl_value_new_list();
415  fl_value_append_take(args, fl_value_new_string("test/standard-method"));
418  fl_method_channel_invoke_method(channel, "InvokeMethod", args, nullptr,
419  nullptr, loop);
420 
421  // Blocks here until method_call_not_implemented_response_cb is called.
422  g_main_loop_run(loop);
423 }

References args, fl_binary_messenger_new(), fl_binary_messenger_set_message_handler_on_channel(), fl_method_channel_invoke_method(), fl_method_channel_new(), fl_method_channel_set_method_call_handler(), fl_standard_method_codec_new(), fl_value_append_take(), fl_value_new_list(), fl_value_new_string(), make_mock_engine(), method_call_not_implemented_cb(), and method_call_not_implemented_response_cb().

◆ TEST() [10/12]

TEST ( FlMethodChannelTest  ,
ReceiveMethodCallRespondSuccess   
)

Definition at line 249 of file fl_method_channel_test.cc.

249  {
250  g_autoptr(GMainLoop) loop = g_main_loop_new(nullptr, 0);
251 
252  g_autoptr(FlEngine) engine = make_mock_engine();
253  g_autoptr(FlBinaryMessenger) messenger = fl_binary_messenger_new(engine);
254  g_autoptr(FlStandardMethodCodec) codec = fl_standard_method_codec_new();
255  g_autoptr(FlMethodChannel) channel = fl_method_channel_new(
256  messenger, "test/standard-method", FL_METHOD_CODEC(codec));
258  nullptr, nullptr);
259 
260  // Listen for response from the engine.
262  messenger, "test/responses", method_call_success_response_cb, loop,
263  nullptr);
264 
265  // Trigger the engine to make a method call.
266  g_autoptr(FlValue) args = fl_value_new_list();
267  fl_value_append_take(args, fl_value_new_string("test/standard-method"));
270  fl_method_channel_invoke_method(channel, "InvokeMethod", args, nullptr,
271  nullptr, loop);
272 
273  // Blocks here until method_call_success_response_cb is called.
274  g_main_loop_run(loop);
275 }

References args, fl_binary_messenger_new(), fl_binary_messenger_set_message_handler_on_channel(), fl_method_channel_invoke_method(), fl_method_channel_new(), fl_method_channel_set_method_call_handler(), fl_standard_method_codec_new(), fl_value_append_take(), fl_value_new_list(), fl_value_new_string(), make_mock_engine(), method_call_success_cb(), and method_call_success_response_cb().

◆ TEST() [11/12]

TEST ( FlMethodChannelTest  ,
ReceiveMethodCallRespondSuccessError   
)

Definition at line 542 of file fl_method_channel_test.cc.

542  {
543  g_autoptr(GMainLoop) loop = g_main_loop_new(nullptr, 0);
544 
545  g_autoptr(FlEngine) engine = make_mock_engine();
546  g_autoptr(FlBinaryMessenger) messenger = fl_binary_messenger_new(engine);
547  g_autoptr(TestMethodCodec) codec = test_method_codec_new();
548  g_autoptr(FlMethodChannel) channel = fl_method_channel_new(
549  messenger, "test/standard-method", FL_METHOD_CODEC(codec));
551  channel, method_call_success_error_cb, loop, nullptr);
552 
553  // Trigger the engine to make a method call.
554  g_autoptr(FlValue) args = fl_value_new_list();
555  fl_value_append_take(args, fl_value_new_string("test/standard-method"));
558  fl_method_channel_invoke_method(channel, "InvokeMethod", args, nullptr,
559  nullptr, loop);
560 
561  // Blocks here until method_call_success_error_cb is called.
562  g_main_loop_run(loop);
563 }

References args, fl_binary_messenger_new(), fl_method_channel_invoke_method(), fl_method_channel_new(), fl_method_channel_set_method_call_handler(), fl_value_append_take(), fl_value_new_list(), fl_value_new_string(), make_mock_engine(), method_call_success_error_cb(), and test_method_codec_new().

◆ TEST() [12/12]

TEST ( FlMethodChannelTest  ,
ReplaceADisposedMethodChannel   
)

Definition at line 636 of file fl_method_channel_test.cc.

636  {
637  const char* method_name = "test/standard-method";
638  // The loop is used to pause the main process until the callback is fully
639  // executed.
640  g_autoptr(GMainLoop) loop = g_main_loop_new(nullptr, 0);
641  g_autoptr(FlEngine) engine = make_mock_engine();
642  g_autoptr(FlBinaryMessenger) messenger = fl_binary_messenger_new(engine);
643  g_autoptr(FlStandardMethodCodec) codec = fl_standard_method_codec_new();
644 
645  g_autoptr(FlValue) args = fl_value_new_list();
649 
650  // Register the first channel and test if it works.
651  UserDataReassignMethod user_data1{
652  .loop = loop,
653  .count = 100,
654  };
655  FlMethodChannel* channel1 =
656  fl_method_channel_new(messenger, method_name, FL_METHOD_CODEC(codec));
658  &user_data1, nullptr);
659 
660  fl_method_channel_invoke_method(channel1, "InvokeMethod", args, nullptr,
661  nullptr, nullptr);
662  g_main_loop_run(loop);
663  EXPECT_EQ(user_data1.count, 101);
664 
665  // Dispose the first channel.
666  g_object_unref(channel1);
667 
668  // Register the second channel and test if it works.
669  UserDataReassignMethod user_data2{
670  .loop = loop,
671  .count = 100,
672  };
673  g_autoptr(FlMethodChannel) channel2 =
674  fl_method_channel_new(messenger, method_name, FL_METHOD_CODEC(codec));
676  &user_data2, nullptr);
677 
678  fl_method_channel_invoke_method(channel2, "InvokeMethod", args, nullptr,
679  nullptr, nullptr);
680  g_main_loop_run(loop);
681 
682  EXPECT_EQ(user_data1.count, 101);
683  EXPECT_EQ(user_data2.count, 101);
684 }

References args, fl_binary_messenger_new(), fl_method_channel_invoke_method(), fl_method_channel_new(), fl_method_channel_set_method_call_handler(), fl_standard_method_codec_new(), fl_value_append_take(), fl_value_new_list(), fl_value_new_string(), UserDataReassignMethod::loop, make_mock_engine(), and reassign_method_cb().

◆ test_method_codec_class_init()

static void test_method_codec_class_init ( TestMethodCodecClass *  klass)
static

Definition at line 501 of file fl_method_channel_test.cc.

501  {
502  G_OBJECT_CLASS(klass)->dispose = test_method_codec_dispose;
503  FL_METHOD_CODEC_CLASS(klass)->encode_method_call =
505  FL_METHOD_CODEC_CLASS(klass)->decode_method_call =
507  FL_METHOD_CODEC_CLASS(klass)->encode_success_envelope =
509  FL_METHOD_CODEC_CLASS(klass)->encode_error_envelope =
511  FL_METHOD_CODEC_CLASS(klass)->decode_response =
513 }

References test_method_codec_decode_method_call(), test_method_codec_decode_response(), test_method_codec_dispose(), test_method_codec_encode_error_envelope(), test_method_codec_encode_method_call(), and test_method_codec_encode_success_envelope().

◆ test_method_codec_decode_method_call()

static gboolean test_method_codec_decode_method_call ( FlMethodCodec *  codec,
GBytes *  message,
gchar **  name,
FlValue **  args,
GError **  error 
)
static

Definition at line 460 of file fl_method_channel_test.cc.

464  {
465  EXPECT_TRUE(TEST_IS_METHOD_CODEC(codec));
466  TestMethodCodec* self = TEST_METHOD_CODEC(codec);
468  FL_METHOD_CODEC(self->wrapped_codec), message, name, args, error);
469 }

References args, error, and fl_method_codec_decode_method_call().

Referenced by test_method_codec_class_init().

◆ test_method_codec_decode_response()

static FlMethodResponse* test_method_codec_decode_response ( FlMethodCodec *  codec,
GBytes *  message,
GError **  error 
)
static

Definition at line 492 of file fl_method_channel_test.cc.

494  {
495  EXPECT_TRUE(TEST_IS_METHOD_CODEC(codec));
496  TestMethodCodec* self = TEST_METHOD_CODEC(codec);
497  return fl_method_codec_decode_response(FL_METHOD_CODEC(self->wrapped_codec),
498  message, error);
499 }

References error, and fl_method_codec_decode_response().

Referenced by test_method_codec_class_init().

◆ test_method_codec_dispose()

static void test_method_codec_dispose ( GObject *  object)
static

Definition at line 440 of file fl_method_channel_test.cc.

440  {
441  TestMethodCodec* self = TEST_METHOD_CODEC(object);
442 
443  g_clear_object(&self->wrapped_codec);
444 
445  G_OBJECT_CLASS(test_method_codec_parent_class)->dispose(object);
446 }

Referenced by test_method_codec_class_init().

◆ test_method_codec_encode_error_envelope()

static GBytes* test_method_codec_encode_error_envelope ( FlMethodCodec *  codec,
const gchar *  code,
const gchar *  message,
FlValue details,
GError **  error 
)
static

Definition at line 481 of file fl_method_channel_test.cc.

485  {
487  "Unsupported type");
488  return nullptr;
489 }

References error, FL_MESSAGE_CODEC_ERROR, and FL_MESSAGE_CODEC_ERROR_FAILED.

Referenced by test_method_codec_class_init().

◆ test_method_codec_encode_method_call()

static GBytes* test_method_codec_encode_method_call ( FlMethodCodec *  codec,
const gchar *  name,
FlValue args,
GError **  error 
)
static

Definition at line 449 of file fl_method_channel_test.cc.

452  {
453  EXPECT_TRUE(TEST_IS_METHOD_CODEC(codec));
454  TestMethodCodec* self = TEST_METHOD_CODEC(codec);
456  FL_METHOD_CODEC(self->wrapped_codec), name, args, error);
457 }

References args, error, and fl_method_codec_encode_method_call().

Referenced by test_method_codec_class_init().

◆ test_method_codec_encode_success_envelope()

static GBytes* test_method_codec_encode_success_envelope ( FlMethodCodec *  codec,
FlValue result,
GError **  error 
)
static

Definition at line 472 of file fl_method_channel_test.cc.

474  {
476  "Unsupported type");
477  return nullptr;
478 }

References error, FL_MESSAGE_CODEC_ERROR, and FL_MESSAGE_CODEC_ERROR_FAILED.

Referenced by test_method_codec_class_init().

◆ test_method_codec_init()

static void test_method_codec_init ( TestMethodCodec *  self)
static

Definition at line 515 of file fl_method_channel_test.cc.

515  {
516  self->wrapped_codec = fl_standard_method_codec_new();
517 }

References fl_standard_method_codec_new().

◆ test_method_codec_new()

TestMethodCodec* test_method_codec_new ( )

Definition at line 519 of file fl_method_channel_test.cc.

519  {
520  return TEST_METHOD_CODEC(g_object_new(test_method_codec_get_type(), nullptr));
521 }

Referenced by TEST().

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
fl_method_channel_new
G_MODULE_EXPORT FlMethodChannel * fl_method_channel_new(FlBinaryMessenger *messenger, const gchar *name, FlMethodCodec *codec)
Definition: fl_method_channel.cc:112
method_call_success_cb
static void method_call_success_cb(FlMethodChannel *channel, FlMethodCall *method_call, gpointer user_data)
Definition: fl_method_channel_test.cc:206
not_implemented_response_cb
static void not_implemented_response_cb(GObject *object, GAsyncResult *result, gpointer user_data)
Definition: fl_method_channel_test.cc:142
method_call_not_implemented_cb
static void method_call_not_implemented_cb(FlMethodChannel *channel, FlMethodCall *method_call, gpointer user_data)
Definition: fl_method_channel_test.cc:359
test_method_codec_encode_method_call
static GBytes * test_method_codec_encode_method_call(FlMethodCodec *codec, const gchar *name, FlValue *args, GError **error)
Definition: fl_method_channel_test.cc:449
fl_standard_method_codec_new
G_MODULE_EXPORT FlStandardMethodCodec * fl_standard_method_codec_new()
Definition: fl_standard_method_codec.cc:291
method_call_success_error_cb
static void method_call_success_error_cb(FlMethodChannel *channel, FlMethodCall *method_call, gpointer user_data)
Definition: fl_method_channel_test.cc:525
fl_value_new_list
G_MODULE_EXPORT FlValue * fl_value_new_list()
Definition: fl_value.cc:349
method_call_error_error_cb
static void method_call_error_error_cb(FlMethodChannel *channel, FlMethodCall *method_call, gpointer user_data)
Definition: fl_method_channel_test.cc:567
fl_method_channel_invoke_method_finish
G_MODULE_EXPORT FlMethodResponse * fl_method_channel_invoke_method_finish(FlMethodChannel *self, GAsyncResult *result, GError **error)
Definition: fl_method_channel.cc:192
FlValue
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:42
user_data
FlKeyEvent uint64_t FlKeyResponderAsyncCallback gpointer user_data
Definition: fl_key_channel_responder.cc:121
fl_method_response_get_result
G_MODULE_EXPORT FlValue * fl_method_response_get_result(FlMethodResponse *self, GError **error)
Definition: fl_method_response.cc:82
fl_value_new_int
G_MODULE_EXPORT FlValue * fl_value_new_int(int64_t value)
Definition: fl_value.cc:262
fl_value_get_string
const G_MODULE_EXPORT gchar * fl_value_get_string(FlValue *self)
Definition: fl_value.cc:682
failure_response_cb
static void failure_response_cb(GObject *object, GAsyncResult *result, gpointer user_data)
Definition: fl_method_channel_test.cc:175
test_method_codec_encode_error_envelope
static GBytes * test_method_codec_encode_error_envelope(FlMethodCodec *codec, const gchar *code, const gchar *message, FlValue *details, GError **error)
Definition: fl_method_channel_test.cc:481
fl_method_error_response_get_message
const G_MODULE_EXPORT gchar * fl_method_error_response_get_message(FlMethodErrorResponse *self)
Definition: fl_method_response.cc:166
method_call_error_cb
static void method_call_error_cb(FlMethodChannel *channel, FlMethodCall *method_call, gpointer user_data)
Definition: fl_method_channel_test.cc:279
fl_binary_messenger_new
FlBinaryMessenger * fl_binary_messenger_new(FlEngine *engine)
Definition: fl_binary_messenger.cc:399
FL_VALUE_TYPE_NULL
@ FL_VALUE_TYPE_NULL
Definition: fl_value.h:65
make_mock_engine
static FlEngine * make_mock_engine()
Definition: fl_event_channel_test.cc:24
fl_method_error_response_get_details
G_MODULE_EXPORT FlValue * fl_method_error_response_get_details(FlMethodErrorResponse *self)
Definition: fl_method_response.cc:172
test_method_codec_new
TestMethodCodec * test_method_codec_new()
Definition: fl_method_channel_test.cc:519
fl_value_get_type
G_MODULE_EXPORT FlValueType fl_value_get_type(FlValue *self)
Definition: fl_value.cc:466
fl_method_call_respond_success
G_MODULE_EXPORT gboolean fl_method_call_respond_success(FlMethodCall *self, FlValue *result, GError **error)
Definition: fl_method_call.cc:100
fl_method_call_respond_not_implemented
G_MODULE_EXPORT gboolean fl_method_call_respond_not_implemented(FlMethodCall *self, GError **error)
Definition: fl_method_call.cc:125
method_call
G_BEGIN_DECLS G_MODULE_EXPORT FlMethodCall * method_call
Definition: fl_method_channel.h:120
FL_VALUE_TYPE_STRING
@ FL_VALUE_TYPE_STRING
Definition: fl_value.h:69
UserDataReassignMethod::loop
GMainLoop * loop
Definition: fl_method_channel_test.cc:608
test_method_codec_decode_method_call
static gboolean test_method_codec_decode_method_call(FlMethodCodec *codec, GBytes *message, gchar **name, FlValue **args, GError **error)
Definition: fl_method_channel_test.cc:460
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_method_call_get_name
const G_MODULE_EXPORT gchar * fl_method_call_get_name(FlMethodCall *self)
Definition: fl_method_call.cc:67
fl_binary_messenger_set_message_handler_on_channel
G_MODULE_EXPORT void fl_binary_messenger_set_message_handler_on_channel(FlBinaryMessenger *self, const gchar *channel, FlBinaryMessengerMessageHandler handler, gpointer user_data, GDestroyNotify destroy_notify)
Definition: fl_binary_messenger.cc:416
fl_method_success_response_get_result
G_MODULE_EXPORT FlValue * fl_method_success_response_get_result(FlMethodSuccessResponse *self)
Definition: fl_method_response.cc:138
FL_MESSAGE_CODEC_ERROR_FAILED
@ FL_MESSAGE_CODEC_ERROR_FAILED
Definition: fl_message_codec.h:34
fl_value_append_take
G_MODULE_EXPORT void fl_value_append_take(FlValue *self, FlValue *value)
Definition: fl_value.cc:600
fl_method_codec_decode_response
FlMethodResponse * fl_method_codec_decode_response(FlMethodCodec *self, GBytes *message, GError **error)
Definition: fl_method_codec.cc:62
method_call_not_implemented_response_cb
static void method_call_not_implemented_response_cb(FlBinaryMessenger *messenger, const gchar *channel, GBytes *message, FlBinaryMessengerResponseHandle *response_handle, gpointer user_data)
Definition: fl_method_channel_test.cc:375
method_response_cb
static void method_response_cb(GObject *object, GAsyncResult *result, gpointer user_data)
Definition: fl_method_channel_test.cc:19
fl_method_channel_invoke_method
G_MODULE_EXPORT void fl_method_channel_invoke_method(FlMethodChannel *self, const gchar *method, FlValue *args, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data)
Definition: fl_method_channel.cc:162
test_method_codec_encode_success_envelope
static GBytes * test_method_codec_encode_success_envelope(FlMethodCodec *codec, FlValue *result, GError **error)
Definition: fl_method_channel_test.cc:472
fl_method_channel_set_method_call_handler
G_MODULE_EXPORT void fl_method_channel_set_method_call_handler(FlMethodChannel *self, FlMethodChannelMethodCallHandler handler, gpointer user_data, GDestroyNotify destroy_notify)
Definition: fl_method_channel.cc:134
result
GAsyncResult * result
Definition: fl_text_input_handler.cc:106
nullptr_args_response_cb
static void nullptr_args_response_cb(GObject *object, GAsyncResult *result, gpointer user_data)
Definition: fl_method_channel_test.cc:58
fl_method_error_response_get_code
const G_MODULE_EXPORT gchar * fl_method_error_response_get_code(FlMethodErrorResponse *self)
Definition: fl_method_response.cc:160
reassign_method_cb
static void reassign_method_cb(FlMethodChannel *channel, FlMethodCall *method_call, gpointer raw_user_data)
Definition: fl_method_channel_test.cc:614
args
G_BEGIN_DECLS G_MODULE_EXPORT FlValue * args
Definition: fl_event_channel.h:89
error
const uint8_t uint32_t uint32_t GError ** error
Definition: fl_pixel_buffer_texture_test.cc:40
fl_method_call_respond_error
G_MODULE_EXPORT gboolean fl_method_call_respond_error(FlMethodCall *self, const gchar *code, const gchar *message, FlValue *details, GError **error)
Definition: fl_method_call.cc:111
UserDataReassignMethod
Definition: fl_method_channel_test.cc:607
method_call_error_response_cb
static void method_call_error_response_cb(FlBinaryMessenger *messenger, const gchar *channel, GBytes *message, FlBinaryMessengerResponseHandle *response_handle, gpointer user_data)
Definition: fl_method_channel_test.cc:297
test_method_codec_decode_response
static FlMethodResponse * test_method_codec_decode_response(FlMethodCodec *codec, GBytes *message, GError **error)
Definition: fl_method_channel_test.cc:492
fl_binary_messenger_send_response
G_MODULE_EXPORT gboolean fl_binary_messenger_send_response(FlBinaryMessenger *self, FlBinaryMessengerResponseHandle *response_handle, GBytes *response, GError **error)
Definition: fl_binary_messenger.cc:430
test_method_codec_dispose
static void test_method_codec_dispose(GObject *object)
Definition: fl_method_channel_test.cc:440
method_call_success_response_cb
static void method_call_success_response_cb(FlBinaryMessenger *messenger, const gchar *channel, GBytes *message, FlBinaryMessengerResponseHandle *response_handle, gpointer user_data)
Definition: fl_method_channel_test.cc:223
fl_method_call_get_args
G_MODULE_EXPORT FlValue * fl_method_call_get_args(FlMethodCall *self)
Definition: fl_method_call.cc:72
error_response_cb
static void error_response_cb(GObject *object, GAsyncResult *result, gpointer user_data)
Definition: fl_method_channel_test.cc:94
fl_value_new_string
G_MODULE_EXPORT FlValue * fl_value_new_string(const gchar *value)
Definition: fl_value.cc:276
FL_MESSAGE_CODEC_ERROR
#define FL_MESSAGE_CODEC_ERROR
Definition: fl_message_codec.h:30