Flutter Engine
mock_engine.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 // This file is a historical legacy, predating the proc table API. It has been
6 // updated to continue to work with the proc table, but new tests should not
7 // rely on replacements set up here, but instead use test-local replacements
8 // for any functions relevant to that test.
9 //
10 // Over time existing tests should be migrated and this file should be removed.
11 
12 #include <cstring>
13 #include <unordered_map>
14 
15 #include "flutter/shell/platform/embedder/embedder.h"
16 #include "flutter/shell/platform/linux/fl_method_codec_private.h"
17 #include "flutter/shell/platform/linux/public/flutter_linux/fl_json_message_codec.h"
18 #include "flutter/shell/platform/linux/public/flutter_linux/fl_method_response.h"
19 #include "flutter/shell/platform/linux/public/flutter_linux/fl_standard_method_codec.h"
20 #include "gtest/gtest.h"
21 
23 
26 };
27 
29  bool running;
32  void* user_data;
33  std::unordered_map<int64_t, _FlutterEngineTexture> textures;
34 
36  FlutterTaskRunnerPostTaskCallback platform_post_task_callback,
37  void* user_data)
38  : running(false),
39  platform_message_callback(platform_message_callback),
40  platform_post_task_callback(platform_post_task_callback),
41  user_data(user_data) {}
42 };
43 
46  void* user_data;
47  std::string channel;
48  bool released;
49 
50  // Constructor for a response handle generated by the engine.
51  explicit _FlutterPlatformMessageResponseHandle(std::string channel)
52  : data_callback(nullptr),
53  user_data(nullptr),
54  channel(channel),
55  released(false) {}
56 
57  // Constructor for a response handle generated by the shell.
59  void* user_data)
60  : data_callback(data_callback), user_data(user_data), released(false) {}
61 };
62 
64  uint64_t task;
65  std::string channel;
67  uint8_t* message;
68  size_t message_size;
69 
71  uint64_t task,
72  const std::string& channel,
73  const FlutterPlatformMessageResponseHandle* response_handle,
74  const uint8_t* message,
75  size_t message_size)
76  : task(task),
77  channel(channel),
78  response_handle(response_handle),
79  message_size(message_size) {
80  if (message_size > 0) {
81  this->message = static_cast<uint8_t*>(malloc(message_size));
82  memcpy(this->message, message, message_size);
83  } else {
84  this->message = nullptr;
85  }
86  }
88  if (response_handle != nullptr) {
89  EXPECT_TRUE(response_handle->released);
90  delete response_handle;
91  }
92  free(message);
93  }
94 };
95 
96 namespace {
97 
98 // Send a response from the engine.
99 static void send_response(
101  const std::string& channel,
102  const FlutterPlatformMessageResponseHandle* response_handle,
103  const uint8_t* message,
104  size_t message_size) {
105  if (response_handle == nullptr) {
106  return;
107  }
108 
109  FlutterTask task;
110  task.runner = new _FlutterTaskRunner(1234, channel, response_handle, message,
111  message_size);
112  task.task = task.runner->task;
113  engine->platform_post_task_callback(task, 0, engine->user_data);
114 }
115 
116 // Send a message from the engine.
117 static void send_message(FLUTTER_API_SYMBOL(FlutterEngine) engine,
118  const std::string& channel,
119  const uint8_t* message,
120  size_t message_size) {
121  FlutterTask task;
122  task.runner =
123  new _FlutterTaskRunner(1234, channel, nullptr, message, message_size);
124  task.task = task.runner->task;
125  engine->platform_post_task_callback(task, 0, engine->user_data);
126 }
127 
128 static void invoke_method(FLUTTER_API_SYMBOL(FlutterEngine) engine,
129  const std::string& channel,
130  const gchar* name,
131  FlValue* args) {
132  g_autoptr(FlStandardMethodCodec) codec = fl_standard_method_codec_new();
133  g_autoptr(GError) error = nullptr;
134  g_autoptr(GBytes) message = fl_method_codec_encode_method_call(
135  FL_METHOD_CODEC(codec), name, args, &error);
136  EXPECT_NE(message, nullptr);
137  EXPECT_EQ(error, nullptr);
138 
139  FlutterTask task;
140  task.runner = new _FlutterTaskRunner(
141  1234, channel, nullptr,
142  static_cast<const uint8_t*>(g_bytes_get_data(message, nullptr)),
143  g_bytes_get_size(message));
144  task.task = task.runner->task;
145  engine->platform_post_task_callback(task, 0, engine->user_data);
146 }
147 
149  const FlutterEngineAOTDataSource* source,
150  FlutterEngineAOTData* data_out) {
151  *data_out = nullptr;
152  return kSuccess;
153 }
154 
156  return kSuccess;
157 }
158 
160  const FlutterRendererConfig* config,
161  const FlutterProjectArgs* args,
162  void* user_data,
164  engine_out) {
165  EXPECT_NE(config, nullptr);
166 
167  EXPECT_NE(args, nullptr);
168  EXPECT_NE(args->platform_message_callback, nullptr);
169  EXPECT_NE(args->custom_task_runners, nullptr);
170  EXPECT_NE(args->custom_task_runners->platform_task_runner, nullptr);
172  nullptr);
173 
174  EXPECT_NE(user_data, nullptr);
175 
176  EXPECT_EQ(config->type, kOpenGL);
177 
178  *engine_out = new _FlutterEngine(
181  user_data);
182  return kSuccess;
183 }
184 
187  engine->running = true;
188  return kSuccess;
189 }
190 
192  const FlutterRendererConfig* config,
193  const FlutterProjectArgs* args,
194  void* user_data,
196  engine_out) {
197  EXPECT_NE(config, nullptr);
198  EXPECT_NE(args, nullptr);
199  EXPECT_NE(user_data, nullptr);
200  EXPECT_NE(engine_out, nullptr);
201 
203  FlutterEngineInitialize(version, config, args, user_data, engine_out);
204  if (result != kSuccess) {
205  return result;
206  }
207  return FlutterEngineRunInitialized(*engine_out);
208 }
209 
211  engine) {
212  delete engine;
213  return kSuccess;
214 }
215 
217  engine) {
218  return kSuccess;
219 }
220 
224  EXPECT_TRUE(engine->running);
225  return kSuccess;
226 }
227 
230  const FlutterPointerEvent* events,
231  size_t events_count) {
232  return kSuccess;
233 }
234 
236  engine,
237  const FlutterKeyEvent* event,
239  void* user_data) {
240  return kSuccess;
241 }
242 
246  const FlutterPlatformMessage* message) {
247  EXPECT_TRUE(engine->running);
248 
249  if (strcmp(message->channel, "test/echo") == 0) {
250  // Responds with the same message received.
251  send_response(engine, message->channel, message->response_handle,
252  message->message, message->message_size);
253  } else if (strcmp(message->channel, "test/send-message") == 0) {
254  // Triggers the engine to send a message.
255  send_response(engine, message->channel, message->response_handle, nullptr,
256  0);
257  send_message(engine, "test/messages", message->message,
258  message->message_size);
259  } else if (strcmp(message->channel, "test/standard-method") == 0) {
260  g_autoptr(FlStandardMethodCodec) codec = fl_standard_method_codec_new();
261  g_autoptr(GBytes) m = g_bytes_new(message->message, message->message_size);
262  g_autofree gchar* name = nullptr;
263  g_autoptr(FlValue) args = nullptr;
264  g_autoptr(GError) error = nullptr;
265  EXPECT_TRUE(fl_method_codec_decode_method_call(FL_METHOD_CODEC(codec), m,
266  &name, &args, &error));
267  EXPECT_EQ(error, nullptr);
268 
269  g_autoptr(GBytes) response = nullptr;
270  if (strcmp(name, "Echo") == 0) {
271  // Returns args as a success result.
272  response = fl_method_codec_encode_success_envelope(FL_METHOD_CODEC(codec),
273  args, &error);
274  EXPECT_EQ(error, nullptr);
275  } else if (strcmp(name, "Error") == 0) {
276  // Returns an error result.
277  const gchar* code = nullptr;
278  const gchar* message = nullptr;
279  FlValue* details = nullptr;
280  if (fl_value_get_length(args) >= 2) {
281  FlValue* code_value = fl_value_get_list_value(args, 0);
282  EXPECT_EQ(fl_value_get_type(code_value), FL_VALUE_TYPE_STRING);
283  code = fl_value_get_string(code_value);
284  FlValue* message_value = fl_value_get_list_value(args, 1);
285  message = fl_value_get_type(message_value) == FL_VALUE_TYPE_STRING
286  ? fl_value_get_string(message_value)
287  : nullptr;
288  }
289  if (fl_value_get_length(args) >= 3) {
290  details = fl_value_get_list_value(args, 2);
291  }
293  FL_METHOD_CODEC(codec), code, message, details, &error);
294  EXPECT_EQ(error, nullptr);
295  } else if (strcmp(name, "InvokeMethod") == 0) {
296  // Gets the engine to call the shell.
297  if (fl_value_get_length(args) == 3) {
298  FlValue* channel_value = fl_value_get_list_value(args, 0);
299  EXPECT_EQ(fl_value_get_type(channel_value), FL_VALUE_TYPE_STRING);
300  const gchar* channel = fl_value_get_string(channel_value);
301  FlValue* name_value = fl_value_get_list_value(args, 1);
302  EXPECT_EQ(fl_value_get_type(name_value), FL_VALUE_TYPE_STRING);
303  const gchar* name = fl_value_get_string(name_value);
304  FlValue* method_args = fl_value_get_list_value(args, 2);
305  invoke_method(engine, channel, name, method_args);
306  }
307  response = fl_method_codec_encode_success_envelope(FL_METHOD_CODEC(codec),
308  nullptr, &error);
309  EXPECT_EQ(error, nullptr);
310  } else {
311  // Returns "not implemented".
312  response = g_bytes_new(nullptr, 0);
313  }
314 
316  engine, message->channel, message->response_handle,
317  static_cast<const uint8_t*>(g_bytes_get_data(response, nullptr)),
318  g_bytes_get_size(response));
319  } else if (strcmp(message->channel, "test/nullptr-response") == 0) {
320  // Sends a null response.
321  send_response(engine, message->channel, message->response_handle, nullptr,
322  0);
323  } else if (strcmp(message->channel, "test/standard-event") == 0) {
324  // Send a message so the shell can check the events sent.
325  send_message(engine, "test/events", message->message,
326  message->message_size);
327  } else if (strcmp(message->channel, "test/failure") == 0) {
328  // Generates an internal error.
329  return kInternalInconsistency;
330  } else if (strcmp(message->channel, "test/key-event-handled") == 0 ||
331  strcmp(message->channel, "test/key-event-not-handled") == 0) {
332  bool value = strcmp(message->channel, "test/key-event-handled") == 0;
333  g_autoptr(FlJsonMessageCodec) codec = fl_json_message_codec_new();
334  g_autoptr(FlValue) handledValue = fl_value_new_map();
335  fl_value_set_string_take(handledValue, "handled", fl_value_new_bool(value));
336  g_autoptr(GBytes) response = fl_message_codec_encode_message(
337  FL_MESSAGE_CODEC(codec), handledValue, nullptr);
339  engine, message->channel, message->response_handle,
340  static_cast<const uint8_t*>(g_bytes_get_data(response, nullptr)),
341  g_bytes_get_size(response));
342  } else if (strcmp(message->channel, "test/key-event-delayed") == 0) {
343  static std::unique_ptr<const FlutterPlatformMessageResponseHandle>
344  delayed_response_handle = nullptr;
345  g_autoptr(FlJsonMessageCodec) codec = fl_json_message_codec_new();
346  g_autoptr(FlValue) handledValue = fl_value_new_map();
347  fl_value_set_string_take(handledValue, "handled", fl_value_new_bool(true));
348  g_autoptr(GBytes) response = fl_message_codec_encode_message(
349  FL_MESSAGE_CODEC(codec), handledValue, nullptr);
350  if (delayed_response_handle == nullptr) {
351  delayed_response_handle.reset(message->response_handle);
352  } else {
354  engine, message->channel, message->response_handle,
355  static_cast<const uint8_t*>(g_bytes_get_data(response, nullptr)),
356  g_bytes_get_size(response));
358  engine, message->channel, delayed_response_handle.release(),
359  static_cast<const uint8_t*>(g_bytes_get_data(response, nullptr)),
360  g_bytes_get_size(response));
361  }
362  }
363 
364  return kSuccess;
365 }
366 
369  FlutterDataCallback data_callback,
370  void* user_data,
371  FlutterPlatformMessageResponseHandle** response_out) {
372  EXPECT_TRUE(engine->running);
373  EXPECT_NE(data_callback, nullptr);
374  EXPECT_NE(user_data, nullptr);
375 
377  new _FlutterPlatformMessageResponseHandle(data_callback, user_data);
378 
379  *response_out = handle;
380  return kSuccess;
381 }
382 
386  EXPECT_NE(engine, nullptr);
387  EXPECT_NE(response, nullptr);
388 
389  EXPECT_TRUE(engine->running);
390 
391  EXPECT_FALSE(response->released);
392  response->released = true;
393 
394  return kSuccess;
395 }
396 
400  const uint8_t* data,
401  size_t data_length) {
402  EXPECT_NE(engine, nullptr);
403  EXPECT_NE(handle, nullptr);
404 
405  EXPECT_TRUE(engine->running);
406 
407  // Send a message so the shell can check the responses received.
408  if (handle->channel != "test/responses") {
409  send_message(engine, "test/responses", data, data_length);
410  }
411 
412  EXPECT_FALSE(handle->released);
413 
414  delete handle;
415 
416  return kSuccess;
417 }
418 
420  engine,
421  const FlutterTask* task) {
422  EXPECT_NE(engine, nullptr);
423  EXPECT_NE(task, nullptr);
424  EXPECT_NE(task->runner, nullptr);
425 
426  FlutterTaskRunner runner = task->runner;
427  EXPECT_NE(runner, nullptr);
428  const FlutterPlatformMessageResponseHandle* response_handle =
429  runner->response_handle;
430  if (response_handle != nullptr) {
431  EXPECT_NE(response_handle->data_callback, nullptr);
432  response_handle->data_callback(runner->message, runner->message_size,
433  response_handle->user_data);
434  } else {
437 
438  FlutterPlatformMessage message;
439  message.struct_size = sizeof(FlutterPlatformMessage);
440  message.channel = runner->channel.c_str();
441  message.message = runner->message;
442  message.message_size = runner->message_size;
443  message.response_handle = handle;
444  engine->platform_message_callback(&message, engine->user_data);
445  }
446 
447  delete runner;
448 
449  return kSuccess;
450 }
451 
453  return false;
454 }
455 
457  engine,
458  const FlutterLocale** locales,
459  size_t locales_count) {
460  return kSuccess;
461 }
462 
465  bool enabled) {
466  return kSuccess;
467 }
468 
471  uint64_t id,
473  const uint8_t* data,
474  size_t data_length) {
475  return kSuccess;
476 }
477 
480  int64_t texture_identifier) {
482  texture.has_new_frame = false;
483  engine->textures[texture_identifier] = texture;
484  return kSuccess;
485 }
486 
489  int64_t texture_identifier) {
490  auto val = engine->textures.find(texture_identifier);
491  if (val == std::end(engine->textures)) {
492  return kInvalidArguments;
493  }
494  val->second.has_new_frame = true;
495  return kSuccess;
496 }
497 
500  int64_t texture_identifier) {
501  engine->textures.erase(texture_identifier);
502  return kSuccess;
503 }
504 
505 } // namespace
506 
508  FlutterEngineProcTable* table) {
509  if (!table) {
510  return kInvalidArguments;
511  }
512 
513  FlutterEngineProcTable empty_table = {};
514  *table = empty_table;
515 
518  table->Run = &FlutterEngineRun;
533  table->RunTask = &FlutterEngineRunTask;
542  return kSuccess;
543 }
G_BEGIN_DECLS FlValue * args
_FlutterTaskRunner(uint64_t task, const std::string &channel, const FlutterPlatformMessageResponseHandle *response_handle, const uint8_t *message, size_t message_size)
Definition: mock_engine.cc:70
const char * channel
Definition: embedder.h:758
struct _FlutterEngine * FLUTTER_API_SYMBOL(FlutterEngine)
Definition: embedder.h:228
GBytes * fl_method_codec_encode_method_call(FlMethodCodec *self, const gchar *name, FlValue *args, GError **error)
FlutterEngineRunsAOTCompiledDartCodeFnPtr RunsAOTCompiledDartCode
Definition: embedder.h:2408
G_BEGIN_DECLS FlTexture * texture
const uint8_t uint32_t uint32_t GError ** error
FlutterEngineUpdateSemanticsEnabledFnPtr UpdateSemanticsEnabled
Definition: embedder.h:2396
G_MODULE_EXPORT FlValueType fl_value_get_type(FlValue *self)
Definition: fl_value.cc:428
FLUTTER_EXPORT FlutterEngineResult FlutterEngineDeinitialize(FLUTTER_API_SYMBOL(FlutterEngine) engine)
Stops running the Flutter engine instance. After this call, the embedder is also guaranteed that no m...
Definition: embedder.cc:1365
FlutterEngineResult FlutterPlatformMessageReleaseResponseHandle(FLUTTER_API_SYMBOL(FlutterEngine) engine, FlutterPlatformMessageResponseHandle *response)
Collects the handle created using FlutterPlatformMessageCreateResponseHandle.
Definition: embedder.cc:1722
FlutterEngineResult FlutterEngineRunTask(FLUTTER_API_SYMBOL(FlutterEngine) engine, const FlutterTask *task)
Inform the engine to run the specified task. This task has been given to the engine via the FlutterTa...
Definition: embedder.cc:1956
FlutterEngineRegisterExternalTextureFnPtr RegisterExternalTexture
Definition: embedder.h:2392
void * user_data
Definition: mock_engine.cc:32
FlutterEngineRunTaskFnPtr RunTask
Definition: embedder.h:2406
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:40
FlutterEngineCollectAOTDataFnPtr CollectAOTData
Definition: embedder.h:2377
G_MODULE_EXPORT FlValue * fl_value_new_map()
Definition: fl_value.cc:355
const FlutterPlatformMessageResponseHandle * response_handle
Definition: embedder.h:767
FlutterEngineResult FlutterEngineSendPlatformMessageResponse(FLUTTER_API_SYMBOL(FlutterEngine) engine, const FlutterPlatformMessageResponseHandle *handle, const uint8_t *data, size_t data_length)
Send a response from the native side to a platform message from the Dart Flutter application.
Definition: embedder.cc:1736
const FlutterCustomTaskRunners * custom_task_runners
Definition: embedder.h:1493
FlutterEngineResult FlutterEngineDispatchSemanticsAction(FLUTTER_API_SYMBOL(FlutterEngine) engine, uint64_t id, FlutterSemanticsAction action, const uint8_t *data, size_t data_length)
Dispatch a semantics action to the specified semantics node.
Definition: embedder.cc:1854
FlutterTaskRunner runner
Definition: embedder.h:898
Function-pointer-based versions of the APIs above.
Definition: embedder.h:2372
void * user_data
FlutterEngineDeinitializeFnPtr Deinitialize
Definition: embedder.h:2381
FlutterEngineResult FlutterEngineShutdown(FLUTTER_API_SYMBOL(FlutterEngine) engine)
Shuts down a Flutter engine instance. The engine handle is no longer valid for any calls in the embed...
Definition: embedder.cc:1377
FlutterEngineSendKeyEventFnPtr SendKeyEvent
Definition: embedder.h:2385
FlutterEngineSendPlatformMessageFnPtr SendPlatformMessage
Definition: embedder.h:2386
GAsyncResult * result
FlutterEngineSendPlatformMessageResponseFnPtr SendPlatformMessageResponse
Definition: embedder.h:2391
G_MODULE_EXPORT FlJsonMessageCodec * fl_json_message_codec_new()
FlutterEngineUnregisterExternalTextureFnPtr UnregisterExternalTexture
Definition: embedder.h:2393
FlutterEngineResult FlutterEngineMarkExternalTextureFrameAvailable(FLUTTER_API_SYMBOL(FlutterEngine) engine, int64_t texture_identifier)
Mark that a new texture frame is available for a given texture identifier.
Definition: embedder.cc:1808
FlutterPlatformMessageCallback platform_message_callback
Definition: embedder.h:1402
uint64_t task
Definition: embedder.h:899
FlKeyEvent FlKeyResponderAsyncCallback callback
FlutterEngineUpdateLocalesFnPtr UpdateLocales
Definition: embedder.h:2407
FlutterEngineRunInitializedFnPtr RunInitialized
Definition: embedder.h:2382
G_MODULE_EXPORT FlValue * fl_value_new_bool(bool value)
Definition: fl_value.cc:244
FlutterEngineRunFnPtr Run
Definition: embedder.h:2378
FlutterSemanticsAction
Definition: embedder.h:101
FlKeyEvent * event
static void send_response(FlMethodCall *method_call, FlMethodResponse *response)
void(* FlutterTaskRunnerPostTaskCallback)(FlutterTask, uint64_t, void *)
Definition: embedder.h:902
FlutterEnginePlatformMessageCreateResponseHandleFnPtr PlatformMessageCreateResponseHandle
Definition: embedder.h:2388
G_MODULE_EXPORT FlStandardMethodCodec * fl_standard_method_codec_new()
void(* FlutterPlatformMessageCallback)(const FlutterPlatformMessage *, void *)
Definition: embedder.h:770
FlutterEngineResult FlutterEngineUpdateSemanticsEnabled(FLUTTER_API_SYMBOL(FlutterEngine) engine, bool enabled)
Enable or disable accessibility semantics.
Definition: embedder.cc:1826
FlutterPlatformMessageCallback platform_message_callback
Definition: mock_engine.cc:30
FlutterRendererType type
Definition: embedder.h:555
uint8_t value
FlutterEngineResult FlutterEngineRun(size_t version, const FlutterRendererConfig *config, const FlutterProjectArgs *args, void *user_data, FLUTTER_API_SYMBOL(FlutterEngine) *engine_out)
Initialize and run a Flutter engine instance and return a handle to it. This is a convenience method ...
Definition: embedder.cc:869
FlutterEngineCreateAOTDataFnPtr CreateAOTData
Definition: embedder.h:2376
FlutterEngineResult FlutterEngineCollectAOTData(FlutterEngineAOTData data)
Collects the AOT data.
Definition: embedder.cc:802
const FlutterPlatformMessageResponseHandle * response_handle
Definition: mock_engine.cc:66
const uint8_t * message
Definition: embedder.h:759
FlutterEngineResult FlutterEngineGetProcAddresses(FlutterEngineProcTable *table)
Gets the table of engine function pointers.
Definition: mock_engine.cc:507
FlutterEnginePlatformMessageReleaseResponseHandleFnPtr PlatformMessageReleaseResponseHandle
Definition: embedder.h:2390
FlutterEngineResult FlutterEngineUpdateLocales(FLUTTER_API_SYMBOL(FlutterEngine) engine, const FlutterLocale **locales, size_t locales_count)
Notify a running engine instance that the locale has been updated. The preferred locale must be the f...
Definition: embedder.cc:2001
SemanticsAction action
FlutterEngineResult FlutterEngineSendKeyEvent(FLUTTER_API_SYMBOL(FlutterEngine) engine, const FlutterKeyEvent *event, FlutterKeyEventCallback callback, void *user_data)
Sends a key event to the engine. The framework will decide whether to handle this event in a synchron...
Definition: embedder.cc:1596
FlutterEngineResult FlutterEngineRegisterExternalTexture(FLUTTER_API_SYMBOL(FlutterEngine) engine, int64_t texture_identifier)
Register an external texture with a unique (per engine) identifier. Only rendering backends that supp...
Definition: embedder.cc:1768
G_MODULE_EXPORT FlValue * fl_value_get_list_value(FlValue *self, size_t index)
Definition: fl_value.cc:735
FlutterEngineSendWindowMetricsEventFnPtr SendWindowMetricsEvent
Definition: embedder.h:2383
FlutterEngineResult FlutterEngineInitialize(size_t version, const FlutterRendererConfig *config, const FlutterProjectArgs *args, void *user_data, FLUTTER_API_SYMBOL(FlutterEngine) *engine_out)
Initialize a Flutter engine instance. This does not run the Flutter application code till the Flutter...
Definition: embedder.cc:885
FlutterEngineMarkExternalTextureFrameAvailableFnPtr MarkExternalTextureFrameAvailable
Definition: embedder.h:2395
const int32_t kFlutterSemanticsCustomActionIdBatchEnd
Definition: mock_engine.cc:22
_FlutterEngine(FlutterPlatformMessageCallback platform_message_callback, FlutterTaskRunnerPostTaskCallback platform_post_task_callback, void *user_data)
Definition: mock_engine.cc:35
FlutterEngineShutdownFnPtr Shutdown
Definition: embedder.h:2379
FlutterEngineResult
Definition: embedder.h:65
FlutterTaskRunnerPostTaskCallback platform_post_task_callback
Definition: mock_engine.cc:31
FlutterEngineDispatchSemanticsActionFnPtr DispatchSemanticsAction
Definition: embedder.h:2398
const char * name
Definition: fuchsia.cc:50
_FlutterPlatformMessageResponseHandle(std::string channel)
Definition: mock_engine.cc:51
G_MODULE_EXPORT GBytes * fl_message_codec_encode_message(FlMessageCodec *self, FlValue *message, GError **error)
FlutterEngineResult FlutterEngineUnregisterExternalTexture(FLUTTER_API_SYMBOL(FlutterEngine) engine, int64_t texture_identifier)
Unregister a previous texture registration.
Definition: embedder.cc:1787
const FlutterTaskRunnerDescription * platform_task_runner
Definition: embedder.h:943
G_MODULE_EXPORT const gchar * fl_value_get_string(FlValue *self)
Definition: fl_value.cc:642
_FlutterPlatformMessageResponseHandle(FlutterDataCallback data_callback, void *user_data)
Definition: mock_engine.cc:58
FlutterTaskRunnerPostTaskCallback post_task_callback
Definition: embedder.h:930
GBytes * fl_method_codec_encode_error_envelope(FlMethodCodec *self, const gchar *code, const gchar *message, FlValue *details, GError **error)
FlutterEngineResult FlutterEngineSendPointerEvent(FLUTTER_API_SYMBOL(FlutterEngine) engine, const FlutterPointerEvent *pointers, size_t events_count)
Definition: embedder.cc:1510
void(* FlutterKeyEventCallback)(bool, void *)
Definition: embedder.h:748
G_MODULE_EXPORT void fl_value_set_string_take(FlValue *self, const gchar *key, FlValue *value)
Definition: fl_value.cc:610
std::unordered_map< int64_t, _FlutterEngineTexture > textures
Definition: mock_engine.cc:33
GBytes * fl_method_codec_encode_success_envelope(FlMethodCodec *self, FlValue *result, GError **error)
size_t struct_size
The size of this struct. Must be sizeof(FlutterPlatformMessage).
Definition: embedder.h:757
void(* FlutterDataCallback)(const uint8_t *, size_t, void *)
Definition: embedder.h:774
FlutterEngineResult FlutterEngineSendWindowMetricsEvent(FLUTTER_API_SYMBOL(FlutterEngine) engine, const FlutterWindowMetricsEvent *flutter_metrics)
Definition: embedder.cc:1388
G_MODULE_EXPORT size_t fl_value_get_length(FlValue *self)
Definition: fl_value.cc:684
FlutterEngineSendPointerEventFnPtr SendPointerEvent
Definition: embedder.h:2384
FlutterEngineInitializeFnPtr Initialize
Definition: embedder.h:2380
gboolean fl_method_codec_decode_method_call(FlMethodCodec *self, GBytes *message, gchar **name, FlValue **args, GError **error)
FlutterEngineResult FlutterEngineRunInitialized(FLUTTER_API_SYMBOL(FlutterEngine) engine)
Runs an initialized engine instance. An engine can be initialized via FlutterEngineInitialize. An initialized instance can only be run once. During and after this call, custom task runners supplied by the embedder are expected to start servicing tasks.
Definition: embedder.cc:1326
bool FlutterEngineRunsAOTCompiledDartCode(void)
Returns if the Flutter engine instance will run AOT compiled Dart code. This call has no threading re...
Definition: embedder.cc:2061
#define FLUTTER_EXPORT
FlutterEngineResult FlutterEngineSendPlatformMessage(FLUTTER_API_SYMBOL(FlutterEngine) engine, const FlutterPlatformMessage *flutter_message)
Definition: embedder.cc:1636
FlutterEngineResult FlutterPlatformMessageCreateResponseHandle(FLUTTER_API_SYMBOL(FlutterEngine) engine, FlutterDataCallback data_callback, void *user_data, FlutterPlatformMessageResponseHandle **response_out)
Creates a platform message response handle that allows the embedder to set a native callback for a re...
Definition: embedder.cc:1687
std::string channel
Definition: mock_engine.cc:65
FlutterEngineResult FlutterEngineCreateAOTData(const FlutterEngineAOTDataSource *source, FlutterEngineAOTData *data_out)
Creates the necessary data structures to launch a Flutter Dart application in AOT mode...
Definition: embedder.cc:748