Flutter Engine Uber Docs
Docs for the entire Flutter Engine repo.
 
Loading...
Searching...
No Matches
fl_platform_channel_test.cc File Reference

Go to the source code of this file.

Classes

class  FlPlatformChannelTest
 

Functions

 TEST_F (FlPlatformChannelTest, ExitResponse)
 

Function Documentation

◆ TEST_F()

TEST_F ( FlPlatformChannelTest  ,
ExitResponse   
)

Definition at line 22 of file fl_platform_channel_test.cc.

22 {
24 messenger, "flutter/platform",
25 [](FlMockBinaryMessenger* messenger, GTask* task, const gchar* name,
26 FlValue* args, gpointer user_data) {
27 EXPECT_STREQ(name, "System.requestAppExit");
28 g_autoptr(FlValue) return_value = fl_value_new_map();
29 fl_value_set_string_take(return_value, "response",
30 fl_value_new_string("exit"));
31 return FL_METHOD_RESPONSE(fl_method_success_response_new(return_value));
32 },
33 nullptr);
34
36 g_autoptr(FlPlatformChannel) channel =
37 fl_platform_channel_new(FL_BINARY_MESSENGER(messenger), &vtable, nullptr);
40 [](GObject* object, GAsyncResult* result, gpointer user_data) {
41 g_autoptr(GError) error = nullptr;
44 object, result, &response, &error);
45
46 EXPECT_TRUE(success);
47 EXPECT_EQ(response, FL_PLATFORM_CHANNEL_EXIT_RESPONSE_EXIT);
48
49 g_main_loop_quit(static_cast<GMainLoop*>(user_data));
50 },
51 loop);
52
53 g_main_loop_run(loop);
54}
g_autoptr(FlEngine) engine
G_BEGIN_DECLS G_MODULE_EXPORT FlValue * args
G_MODULE_EXPORT FlMethodSuccessResponse * fl_method_success_response_new(FlValue *result)
const gchar * channel
void fl_mock_binary_messenger_set_json_method_channel(FlMockBinaryMessenger *self, const gchar *channel, FlMockBinaryMessengerMethodChannelHandler handler, gpointer user_data)
const uint8_t uint32_t uint32_t GError ** error
gboolean fl_platform_channel_system_request_app_exit_finish(GObject *object, GAsyncResult *result, FlPlatformChannelExitResponse *exit_response, GError **error)
void fl_platform_channel_system_request_app_exit(FlPlatformChannel *self, FlPlatformChannelExitType type, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data)
FlPlatformChannel * fl_platform_channel_new(FlBinaryMessenger *messenger, FlPlatformChannelVTable *vtable, gpointer user_data)
FlPlatformChannelExitResponse
@ FL_PLATFORM_CHANNEL_EXIT_RESPONSE_EXIT
@ FL_PLATFORM_CHANNEL_EXIT_TYPE_REQUIRED
G_MODULE_EXPORT FlValue * fl_value_new_map()
Definition fl_value.cc:366
G_MODULE_EXPORT void fl_value_set_string_take(FlValue *self, const gchar *key, FlValue *value)
Definition fl_value.cc:650
G_MODULE_EXPORT FlValue * fl_value_new_string(const gchar *value)
Definition fl_value.cc:276
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition fl_value.h:42
const char * name
Definition fuchsia.cc:50

References args, channel, error, fl_method_success_response_new(), fl_mock_binary_messenger_set_json_method_channel(), FL_PLATFORM_CHANNEL_EXIT_RESPONSE_EXIT, FL_PLATFORM_CHANNEL_EXIT_TYPE_REQUIRED, fl_platform_channel_new(), fl_platform_channel_system_request_app_exit(), fl_platform_channel_system_request_app_exit_finish(), fl_value_new_map(), fl_value_new_string(), fl_value_set_string_take(), g_autoptr(), name, and user_data.