Flutter Linux Embedder
fl_event_channel_test.cc
Go to the documentation of this file.
1 // Copyright 2013 The Flutter Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 // Included first as it collides with the X11 headers.
6 #include "gtest/gtest.h"
7 
15 #include "flutter/shell/platform/linux/testing/mock_renderer.h"
16 
17 // Data passed in tests.
18 typedef struct {
19  GMainLoop* loop;
20  int count;
21 } TestData;
22 
23 // Creates a mock engine that responds to platform messages.
24 static FlEngine* make_mock_engine() {
25  g_autoptr(FlDartProject) project = fl_dart_project_new();
26  g_autoptr(FlMockRenderer) renderer = fl_mock_renderer_new();
27  g_autoptr(FlEngine) engine =
28  fl_engine_new_with_renderer(project, FL_RENDERER(renderer));
29  g_autoptr(GError) engine_error = nullptr;
30  EXPECT_TRUE(fl_engine_start(engine, &engine_error));
31  EXPECT_EQ(engine_error, nullptr);
32 
33  return static_cast<FlEngine*>(g_object_ref(engine));
34 }
35 
36 // Triggers the engine to start listening to the channel.
37 static void listen_channel(FlBinaryMessenger* messenger, FlValue* args) {
38  g_autoptr(FlStandardMethodCodec) codec = fl_standard_method_codec_new();
39  g_autoptr(FlMethodChannel) channel = fl_method_channel_new(
40  messenger, "test/standard-method", FL_METHOD_CODEC(codec));
41 
42  // Trigger the engine to make a method call.
43  g_autoptr(FlValue) invoke_args = fl_value_new_list();
44  fl_value_append_take(invoke_args, fl_value_new_string("test/standard-event"));
45  fl_value_append_take(invoke_args, fl_value_new_string("listen"));
46  g_autoptr(FlValue) value =
47  args != nullptr ? fl_value_ref(args) : fl_value_new_null();
48  fl_value_append(invoke_args, value);
49  fl_method_channel_invoke_method(channel, "InvokeMethod", invoke_args, nullptr,
50  nullptr, nullptr);
51 }
52 
53 // Triggers the engine to cancel the subscription to the channel.
54 static void cancel_channel(FlBinaryMessenger* messenger, FlValue* args) {
55  g_autoptr(FlStandardMethodCodec) codec = fl_standard_method_codec_new();
56  g_autoptr(FlMethodChannel) channel = fl_method_channel_new(
57  messenger, "test/standard-method", FL_METHOD_CODEC(codec));
58 
59  // Trigger the engine to make a method call.
60  g_autoptr(FlValue) invoke_args = fl_value_new_list();
61  fl_value_append_take(invoke_args, fl_value_new_string("test/standard-event"));
62  fl_value_append_take(invoke_args, fl_value_new_string("cancel"));
63  g_autoptr(FlValue) value =
64  args != nullptr ? fl_value_ref(args) : fl_value_new_null();
65  fl_value_append(invoke_args, value);
66  fl_method_channel_invoke_method(channel, "InvokeMethod", invoke_args, nullptr,
67  nullptr, nullptr);
68 }
69 
70 // Called when the remote end starts listening on the channel.
71 static FlMethodErrorResponse* listen_listen_cb(FlEventChannel* channel,
72  FlValue* args,
73  gpointer user_data) {
75 
76  g_main_loop_quit(static_cast<GMainLoop*>(user_data));
77 
78  return nullptr;
79 }
80 
81 // Checks we detect a listen event.
82 TEST(FlEventChannelTest, Listen) {
83  g_autoptr(GMainLoop) loop = g_main_loop_new(nullptr, 0);
84 
85  g_autoptr(FlEngine) engine = make_mock_engine();
86  g_autoptr(FlBinaryMessenger) messenger = fl_binary_messenger_new(engine);
87  g_autoptr(FlStandardMethodCodec) codec = fl_standard_method_codec_new();
88  FlEventChannel* channel = fl_event_channel_new(
89  messenger, "test/standard-event", FL_METHOD_CODEC(codec));
91  nullptr);
92 
93  listen_channel(messenger, nullptr);
94 
95  // Blocks here until listen_listen_cb called.
96  g_main_loop_run(loop);
97 
98  // Manually unref because the compiler complains 'channel' is unused.
99  g_object_unref(channel);
100 }
101 
102 // Called when the remote end starts listening on the channel.
103 static FlMethodErrorResponse* listen_exception_listen_cb(
104  FlEventChannel* channel,
105  FlValue* args,
106  gpointer user_data) {
107  return fl_method_error_response_new("LISTEN-ERROR", "LISTEN-ERROR-MESSAGE",
108  nullptr);
109 }
110 
111 // Called when a the test engine notifies us what response we sent in the
112 // ListenException test.
114  FlBinaryMessenger* messenger,
115  const gchar* channel,
116  GBytes* message,
117  FlBinaryMessengerResponseHandle* response_handle,
118  gpointer user_data) {
119  fl_binary_messenger_send_response(messenger, response_handle, nullptr,
120  nullptr);
121 
122  g_autoptr(FlStandardMethodCodec) codec = fl_standard_method_codec_new();
123  g_autoptr(GError) error = nullptr;
124  g_autoptr(FlMethodResponse) response =
125  fl_method_codec_decode_response(FL_METHOD_CODEC(codec), message, &error);
126  EXPECT_NE(response, nullptr);
127  EXPECT_EQ(error, nullptr);
128 
129  EXPECT_TRUE(FL_IS_METHOD_ERROR_RESPONSE(response));
130  EXPECT_STREQ(
131  fl_method_error_response_get_code(FL_METHOD_ERROR_RESPONSE(response)),
132  "LISTEN-ERROR");
133  EXPECT_STREQ(
134  fl_method_error_response_get_message(FL_METHOD_ERROR_RESPONSE(response)),
135  "LISTEN-ERROR-MESSAGE");
136 
137  g_main_loop_quit(static_cast<GMainLoop*>(user_data));
138 }
139 
140 // Checks we can generate a listen exception.
141 TEST(FlEventChannelTest, ListenException) {
142  g_autoptr(GMainLoop) loop = g_main_loop_new(nullptr, 0);
143 
144  g_autoptr(FlEngine) engine = make_mock_engine();
145  g_autoptr(FlBinaryMessenger) messenger = fl_binary_messenger_new(engine);
146  g_autoptr(FlStandardMethodCodec) codec = fl_standard_method_codec_new();
147  FlEventChannel* channel = fl_event_channel_new(
148  messenger, "test/standard-event", FL_METHOD_CODEC(codec));
150  nullptr, loop, nullptr);
151 
152  // Listen for response to the engine.
154  messenger, "test/responses", listen_exception_response_cb, loop, nullptr);
155 
156  listen_channel(messenger, nullptr);
157 
158  // Blocks here until listen_exception_response_cb called.
159  g_main_loop_run(loop);
160 
161  // Manually unref because the compiler complains 'channel' is unused.
162  g_object_unref(channel);
163 }
164 
165 // Called when the remote end cancels their subscription.
166 static FlMethodErrorResponse* cancel_cancel_cb(FlEventChannel* channel,
167  FlValue* args,
168  gpointer user_data) {
170 
171  g_main_loop_quit(static_cast<GMainLoop*>(user_data));
172 
173  return nullptr;
174 }
175 
176 // Checks we detect a cancel event.
177 TEST(FlEventChannelTest, Cancel) {
178  g_autoptr(GMainLoop) loop = g_main_loop_new(nullptr, 0);
179 
180  g_autoptr(FlEngine) engine = make_mock_engine();
181  g_autoptr(FlBinaryMessenger) messenger = fl_binary_messenger_new(engine);
182  g_autoptr(FlStandardMethodCodec) codec = fl_standard_method_codec_new();
183  FlEventChannel* channel = fl_event_channel_new(
184  messenger, "test/standard-event", FL_METHOD_CODEC(codec));
186  nullptr);
187 
188  listen_channel(messenger, nullptr);
189  cancel_channel(messenger, nullptr);
190 
191  // Blocks here until cancel_cancel_cb called.
192  g_main_loop_run(loop);
193 
194  // Manually unref because the compiler complains 'channel' is unused.
195  g_object_unref(channel);
196 }
197 
198 // Called when the remote end cancels their subscription.
199 static FlMethodErrorResponse* cancel_exception_cancel_cb(
200  FlEventChannel* channel,
201  FlValue* args,
202  gpointer user_data) {
203  return fl_method_error_response_new("CANCEL-ERROR", "CANCEL-ERROR-MESSAGE",
204  nullptr);
205 }
206 
207 // Called when a the test engine notifies us what response we sent in the
208 // CancelException test.
210  FlBinaryMessenger* messenger,
211  const gchar* channel,
212  GBytes* message,
213  FlBinaryMessengerResponseHandle* response_handle,
214  gpointer user_data) {
215  TestData* data = static_cast<TestData*>(user_data);
216 
217  fl_binary_messenger_send_response(messenger, response_handle, nullptr,
218  nullptr);
219 
220  data->count++;
221  if (data->count == 2) {
222  g_autoptr(FlStandardMethodCodec) codec = fl_standard_method_codec_new();
223  g_autoptr(GError) error = nullptr;
224  g_autoptr(FlMethodResponse) response = fl_method_codec_decode_response(
225  FL_METHOD_CODEC(codec), message, &error);
226  EXPECT_NE(response, nullptr);
227  EXPECT_EQ(error, nullptr);
228 
229  EXPECT_TRUE(FL_IS_METHOD_ERROR_RESPONSE(response));
230  EXPECT_STREQ(
231  fl_method_error_response_get_code(FL_METHOD_ERROR_RESPONSE(response)),
232  "CANCEL-ERROR");
234  FL_METHOD_ERROR_RESPONSE(response)),
235  "CANCEL-ERROR-MESSAGE");
236 
237  g_main_loop_quit(data->loop);
238  }
239 }
240 
241 // Checks we can generate a cancel exception.
242 TEST(FlEventChannelTest, CancelException) {
243  g_autoptr(GMainLoop) loop = g_main_loop_new(nullptr, 0);
244  TestData data;
245  data.loop = loop;
246  data.count = 0;
247 
248  g_autoptr(FlEngine) engine = make_mock_engine();
249  g_autoptr(FlBinaryMessenger) messenger = fl_binary_messenger_new(engine);
250  g_autoptr(FlStandardMethodCodec) codec = fl_standard_method_codec_new();
251  FlEventChannel* channel = fl_event_channel_new(
252  messenger, "test/standard-event", FL_METHOD_CODEC(codec));
254  channel, nullptr, cancel_exception_cancel_cb, &data, nullptr);
255 
256  // Listen for response to the engine.
258  messenger, "test/responses", cancel_exception_response_cb, &data,
259  nullptr);
260 
261  listen_channel(messenger, nullptr);
262  cancel_channel(messenger, nullptr);
263 
264  // Blocks here until cancel_exception_response_cb called.
265  g_main_loop_run(loop);
266 
267  // Manually unref because the compiler complains 'channel' is unused.
268  g_object_unref(channel);
269 }
270 
271 // Called when the remote end starts listening on the channel.
272 static FlMethodErrorResponse* args_listen_cb(FlEventChannel* channel,
273  FlValue* args,
274  gpointer user_data) {
275  g_autoptr(FlValue) expected_args = fl_value_new_string("LISTEN-ARGS");
276  EXPECT_TRUE(fl_value_equal(args, expected_args));
277 
278  return nullptr;
279 }
280 
281 // Called when the remote end cancels their subscription.
282 static FlMethodErrorResponse* args_cancel_cb(FlEventChannel* channel,
283  FlValue* args,
284  gpointer user_data) {
285  g_autoptr(FlValue) expected_args = fl_value_new_string("CANCEL-ARGS");
286  EXPECT_TRUE(fl_value_equal(args, expected_args));
287 
288  g_main_loop_quit(static_cast<GMainLoop*>(user_data));
289 
290  return nullptr;
291 }
292 
293 // Checks args are passed to listen/cancel.
294 TEST(FlEventChannelTest, Args) {
295  g_autoptr(GMainLoop) loop = g_main_loop_new(nullptr, 0);
296 
297  g_autoptr(FlEngine) engine = make_mock_engine();
298  g_autoptr(FlBinaryMessenger) messenger = fl_binary_messenger_new(engine);
299  g_autoptr(FlStandardMethodCodec) codec = fl_standard_method_codec_new();
300  FlEventChannel* channel = fl_event_channel_new(
301  messenger, "test/standard-event", FL_METHOD_CODEC(codec));
303  loop, nullptr);
304 
305  g_autoptr(FlValue) listen_args = fl_value_new_string("LISTEN-ARGS");
306  listen_channel(messenger, listen_args);
307  g_autoptr(FlValue) cancel_args = fl_value_new_string("CANCEL-ARGS");
308  cancel_channel(messenger, cancel_args);
309 
310  // Blocks here until args_cancel_cb called.
311  g_main_loop_run(loop);
312 
313  // Manually unref because the compiler complains 'channel' is unused.
314  g_object_unref(channel);
315 }
316 
317 // Called when the remote end starts listening on the channel.
318 static FlMethodErrorResponse* send_events_listen_cb(FlEventChannel* channel,
319  FlValue* args,
320  gpointer user_data) {
321  // Send some events.
322  for (int i = 0; i < 5; i++) {
323  g_autoptr(FlValue) event = fl_value_new_int(i);
324  g_autoptr(GError) error = nullptr;
325  EXPECT_TRUE(fl_event_channel_send(channel, event, nullptr, &error));
326  EXPECT_EQ(error, nullptr);
327  }
328 
329  return nullptr;
330 }
331 
332 // Called when a the test engine notifies us what event we sent in the
333 // Test test.
335  FlBinaryMessenger* messenger,
336  const gchar* channel,
337  GBytes* message,
338  FlBinaryMessengerResponseHandle* response_handle,
339  gpointer user_data) {
340  TestData* data = static_cast<TestData*>(user_data);
341 
342  g_autoptr(FlStandardMethodCodec) codec = fl_standard_method_codec_new();
343  g_autoptr(GError) error = nullptr;
344  g_autoptr(FlMethodResponse) response =
345  fl_method_codec_decode_response(FL_METHOD_CODEC(codec), message, &error);
346  EXPECT_NE(response, nullptr);
347  EXPECT_EQ(error, nullptr);
348 
350  EXPECT_NE(result, nullptr);
351  EXPECT_EQ(error, nullptr);
352 
354  EXPECT_EQ(fl_value_get_int(result), data->count);
355  data->count++;
356 
357  fl_binary_messenger_send_response(messenger, response_handle, nullptr,
358  nullptr);
359 
360  // Got all the results!
361  if (data->count == 5) {
362  g_main_loop_quit(data->loop);
363  }
364 }
365 
366 // Checks can send events.
367 TEST(FlEventChannelTest, Test) {
368  g_autoptr(GMainLoop) loop = g_main_loop_new(nullptr, 0);
369  TestData data;
370  data.loop = loop;
371  data.count = 0;
372 
373  g_autoptr(FlEngine) engine = make_mock_engine();
374  g_autoptr(FlBinaryMessenger) messenger = fl_binary_messenger_new(engine);
375  g_autoptr(FlStandardMethodCodec) codec = fl_standard_method_codec_new();
376  FlEventChannel* channel = fl_event_channel_new(
377  messenger, "test/standard-event", FL_METHOD_CODEC(codec));
379  &data, nullptr);
380 
381  // Listen for events from the engine.
383  messenger, "test/events", send_events_events_cb, &data, nullptr);
384 
385  listen_channel(messenger, nullptr);
386  cancel_channel(messenger, nullptr);
387 
388  // Blocks here until send_events_events_cb receives the last event.
389  g_main_loop_run(loop);
390 
391  // Manually unref because the compiler complains 'channel' is unused.
392  g_object_unref(channel);
393 }
394 
395 // Check can register an event channel with the same name as one previously
396 // used.
397 TEST(FlEventChannelTest, ReuseChannel) {
398  g_autoptr(GMainLoop) loop = g_main_loop_new(nullptr, 0);
399  TestData data;
400  data.loop = loop;
401  data.count = 0;
402 
403  // Register an event channel.
404  g_autoptr(FlEngine) engine = make_mock_engine();
405  g_autoptr(FlBinaryMessenger) messenger = fl_binary_messenger_new(engine);
406  g_autoptr(FlStandardMethodCodec) codec = fl_standard_method_codec_new();
407  FlEventChannel* channel1 = fl_event_channel_new(
408  messenger, "test/standard-event", FL_METHOD_CODEC(codec));
410  &data, nullptr);
411 
412  // Remove this channel
413  g_object_unref(channel1);
414 
415  // Register a second channel with the same name.
416  g_autoptr(FlEventChannel) channel2 = fl_event_channel_new(
417  messenger, "test/standard-event", FL_METHOD_CODEC(codec));
419  &data, nullptr);
420 
421  // Listen for events from the engine.
423  messenger, "test/events", send_events_events_cb, &data, nullptr);
424 
425  listen_channel(messenger, nullptr);
426  cancel_channel(messenger, nullptr);
427 
428  // Blocks here until send_events_events_cb receives the last event.
429  g_main_loop_run(loop);
430 }
431 
432 // Check can register an event channel replacing an existing one.
433 TEST(FlEventChannelTest, ReplaceChannel) {
434  g_autoptr(GMainLoop) loop = g_main_loop_new(nullptr, 0);
435  TestData data;
436  data.loop = loop;
437  data.count = 0;
438 
439  // Register an event channel.
440  g_autoptr(FlEngine) engine = make_mock_engine();
441  g_autoptr(FlBinaryMessenger) messenger = fl_binary_messenger_new(engine);
442  g_autoptr(FlStandardMethodCodec) codec = fl_standard_method_codec_new();
443  FlEventChannel* channel1 = fl_event_channel_new(
444  messenger, "test/standard-event", FL_METHOD_CODEC(codec));
446  &data, nullptr);
447 
448  // Register a second channel with the same name.
449  g_autoptr(FlEventChannel) channel2 = fl_event_channel_new(
450  messenger, "test/standard-event", FL_METHOD_CODEC(codec));
452  &data, nullptr);
453 
454  // Listen for events from the engine.
456  messenger, "test/events", send_events_events_cb, &data, nullptr);
457 
458  listen_channel(messenger, nullptr);
459  cancel_channel(messenger, nullptr);
460 
461  // Blocks here until send_events_events_cb receives the last event.
462  g_main_loop_run(loop);
463 }
args_listen_cb
static FlMethodErrorResponse * args_listen_cb(FlEventChannel *channel, FlValue *args, gpointer user_data)
Definition: fl_event_channel_test.cc:272
event
FlKeyEvent * event
Definition: fl_key_channel_responder.cc:118
TestData::loop
GMainLoop * loop
Definition: fl_event_channel_test.cc:19
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
fl_method_error_response_new
G_MODULE_EXPORT FlMethodErrorResponse * fl_method_error_response_new(const gchar *code, const gchar *message, FlValue *details)
Definition: fl_method_response.cc:144
listen_exception_response_cb
static void listen_exception_response_cb(FlBinaryMessenger *messenger, const gchar *channel, GBytes *message, FlBinaryMessengerResponseHandle *response_handle, gpointer user_data)
Definition: fl_event_channel_test.cc:113
TestData::count
int count
Definition: fl_event_channel_test.cc:20
fl_standard_method_codec_new
G_MODULE_EXPORT FlStandardMethodCodec * fl_standard_method_codec_new()
Definition: fl_standard_method_codec.cc:291
fl_value_new_list
G_MODULE_EXPORT FlValue * fl_value_new_list()
Definition: fl_value.cc:349
fl_method_channel.h
i
int i
Definition: fl_socket_accessible.cc:18
cancel_channel
static void cancel_channel(FlBinaryMessenger *messenger, FlValue *args)
Definition: fl_event_channel_test.cc:54
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_value_new_null
G_MODULE_EXPORT FlValue * fl_value_new_null()
Definition: fl_value.cc:251
cancel_exception_cancel_cb
static FlMethodErrorResponse * cancel_exception_cancel_cb(FlEventChannel *channel, FlValue *args, gpointer user_data)
Definition: fl_event_channel_test.cc:199
fl_dart_project_new
G_MODULE_EXPORT FlDartProject * fl_dart_project_new()
Definition: fl_dart_project.cc:50
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_basic_message_channel.h
fl_value_new_int
G_MODULE_EXPORT FlValue * fl_value_new_int(int64_t value)
Definition: fl_value.cc:262
fl_event_channel_send
G_MODULE_EXPORT gboolean fl_event_channel_send(FlEventChannel *self, FlValue *event, GCancellable *cancellable, GError **error)
Definition: fl_event_channel.cc:196
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
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_engine_new_with_renderer
FlEngine * fl_engine_new_with_renderer(FlDartProject *project, FlRenderer *renderer)
Definition: fl_engine.cc:479
fl_value_get_int
G_MODULE_EXPORT int64_t fl_value_get_int(FlValue *self)
Definition: fl_value.cc:668
fl_value_ref
G_MODULE_EXPORT FlValue * fl_value_ref(FlValue *self)
Definition: fl_value.cc:394
TEST
TEST(FlEventChannelTest, Listen)
Definition: fl_event_channel_test.cc:82
args_cancel_cb
static FlMethodErrorResponse * args_cancel_cb(FlEventChannel *channel, FlValue *args, gpointer user_data)
Definition: fl_event_channel_test.cc:282
fl_value_get_type
G_MODULE_EXPORT FlValueType fl_value_get_type(FlValue *self)
Definition: fl_value.cc:466
listen_exception_listen_cb
static FlMethodErrorResponse * listen_exception_listen_cb(FlEventChannel *channel, FlValue *args, gpointer user_data)
Definition: fl_event_channel_test.cc:103
listen_listen_cb
static FlMethodErrorResponse * listen_listen_cb(FlEventChannel *channel, FlValue *args, gpointer user_data)
Definition: fl_event_channel_test.cc:71
fl_event_channel_new
G_MODULE_EXPORT FlEventChannel * fl_event_channel_new(FlBinaryMessenger *messenger, const gchar *name, FlMethodCodec *codec)
Definition: fl_event_channel.cc:159
fl_engine_private.h
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_event_channel.h
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
fl_value_equal
G_MODULE_EXPORT bool fl_value_equal(FlValue *a, FlValue *b)
Definition: fl_value.cc:471
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
fl_standard_method_codec.h
FL_VALUE_TYPE_INT
@ FL_VALUE_TYPE_INT
Definition: fl_value.h:67
send_events_listen_cb
static FlMethodErrorResponse * send_events_listen_cb(FlEventChannel *channel, FlValue *args, gpointer user_data)
Definition: fl_event_channel_test.cc:318
result
GAsyncResult * result
Definition: fl_text_input_handler.cc:106
fl_binary_messenger_private.h
cancel_cancel_cb
static FlMethodErrorResponse * cancel_cancel_cb(FlEventChannel *channel, FlValue *args, gpointer user_data)
Definition: fl_event_channel_test.cc:166
fl_event_channel_set_stream_handlers
G_MODULE_EXPORT void fl_event_channel_set_stream_handlers(FlEventChannel *self, FlEventChannelHandler listen_handler, FlEventChannelHandler cancel_handler, gpointer user_data, GDestroyNotify destroy_notify)
Definition: fl_event_channel.cc:181
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
TestData
Definition: fl_event_channel_test.cc:18
listen_channel
static void listen_channel(FlBinaryMessenger *messenger, FlValue *args)
Definition: fl_event_channel_test.cc:37
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
send_events_events_cb
static void send_events_events_cb(FlBinaryMessenger *messenger, const gchar *channel, GBytes *message, FlBinaryMessengerResponseHandle *response_handle, gpointer user_data)
Definition: fl_event_channel_test.cc:334
fl_engine_start
gboolean fl_engine_start(FlEngine *self, GError **error)
Definition: fl_engine.cc:509
fl_value_append
G_MODULE_EXPORT void fl_value_append(FlValue *self, FlValue *value)
Definition: fl_value.cc:592
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
fl_method_codec_private.h
cancel_exception_response_cb
static void cancel_exception_response_cb(FlBinaryMessenger *messenger, const gchar *channel, GBytes *message, FlBinaryMessengerResponseHandle *response_handle, gpointer user_data)
Definition: fl_event_channel_test.cc:209
value
uint8_t value
Definition: fl_standard_message_codec.cc:36
fl_value_new_string
G_MODULE_EXPORT FlValue * fl_value_new_string(const gchar *value)
Definition: fl_value.cc:276