Flutter Engine
The Flutter Engine
Functions
fl_dart_project_test.cc File Reference
#include "flutter/shell/platform/linux/public/flutter_linux/fl_dart_project.h"
#include <gmodule.h>
#include <cstdlib>
#include "gtest/gtest.h"

Go to the source code of this file.

Functions

 TEST (FlDartProjectTest, GetPaths)
 
 TEST (FlDartProjectTest, OverrideAotLibraryPath)
 
 TEST (FlDartProjectTest, OverrideAssetsPath)
 
 TEST (FlDartProjectTest, OverrideIcuDataPath)
 
 TEST (FlDartProjectTest, DartEntrypointArgs)
 

Function Documentation

◆ TEST() [1/5]

TEST ( FlDartProjectTest  ,
DartEntrypointArgs   
)

Definition at line 55 of file fl_dart_project_test.cc.

55 {
56 g_autoptr(FlDartProject) project = fl_dart_project_new();
57
58 char** retrieved_args =
60
61 EXPECT_EQ(retrieved_args, nullptr);
62
63 GPtrArray* args_array = g_ptr_array_new();
64 g_ptr_array_add(args_array, const_cast<char*>("arg_one"));
65 g_ptr_array_add(args_array, const_cast<char*>("arg_two"));
66 g_ptr_array_add(args_array, const_cast<char*>("arg_three"));
67 g_ptr_array_add(args_array, nullptr);
68 gchar** args = reinterpret_cast<gchar**>(g_ptr_array_free(args_array, false));
69
71
72 retrieved_args = fl_dart_project_get_dart_entrypoint_arguments(project);
73
74 // FlDartProject should have done a deep copy of the args
75 EXPECT_NE(retrieved_args, args);
76
77 EXPECT_EQ(g_strv_length(retrieved_args), 3U);
78}
G_MODULE_EXPORT void fl_dart_project_set_dart_entrypoint_arguments(FlDartProject *self, char **argv)
G_MODULE_EXPORT gchar ** fl_dart_project_get_dart_entrypoint_arguments(FlDartProject *self)
G_MODULE_EXPORT FlDartProject * fl_dart_project_new()
G_BEGIN_DECLS G_MODULE_EXPORT FlValue * args

◆ TEST() [2/5]

TEST ( FlDartProjectTest  ,
GetPaths   
)

Definition at line 13 of file fl_dart_project_test.cc.

13 {
14 g_autoptr(FlDartProject) project = fl_dart_project_new();
15 g_autofree gchar* exe_path = g_file_read_link("/proc/self/exe", nullptr);
16 ASSERT_TRUE(exe_path != nullptr);
17 g_autofree gchar* dir = g_path_get_dirname(exe_path);
18 g_autofree gchar* expected_aot_library_path =
19 g_build_filename(dir, "lib", "libapp.so", nullptr);
20 EXPECT_STREQ(fl_dart_project_get_aot_library_path(project),
21 expected_aot_library_path);
22 g_autofree gchar* expected_assets_path =
23 g_build_filename(dir, "data", "flutter_assets", nullptr);
24 EXPECT_STREQ(fl_dart_project_get_assets_path(project), expected_assets_path);
25 g_autofree gchar* expected_icu_data_path =
26 g_build_filename(dir, "data", "icudtl.dat", nullptr);
27 EXPECT_STREQ(fl_dart_project_get_icu_data_path(project),
28 expected_icu_data_path);
29}
G_MODULE_EXPORT const gchar * fl_dart_project_get_assets_path(FlDartProject *self)
G_MODULE_EXPORT const gchar * fl_dart_project_get_aot_library_path(FlDartProject *self)
G_MODULE_EXPORT const gchar * fl_dart_project_get_icu_data_path(FlDartProject *self)
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir Path to the cache directory This is different from the persistent_cache_path in embedder which is used for Skia shader cache icu native lib Path to the library file that exports the ICU data vm service The hostname IP address on which the Dart VM Service should be served If not defaults to or::depending on whether ipv6 is specified vm service A custom Dart VM Service port The default is to pick a randomly available open port disable vm Disable the Dart VM Service The Dart VM Service is never available in release mode disable vm service Disable mDNS Dart VM Service publication Bind to the IPv6 localhost address for the Dart VM Service Ignored if vm service host is set endless trace Enable an endless trace buffer The default is a ring buffer This is useful when very old events need to viewed For during application launch Memory usage will continue to grow indefinitely however Start app with an specific route defined on the framework flutter assets dir
Definition: switches.h:145

◆ TEST() [3/5]

TEST ( FlDartProjectTest  ,
OverrideAotLibraryPath   
)

Definition at line 31 of file fl_dart_project_test.cc.

31 {
32 g_autoptr(FlDartProject) project = fl_dart_project_new();
33
34 char aot_library_path[] = "/normal/tuesday/night/for/shia/labeouf";
35 fl_dart_project_set_aot_library_path(project, aot_library_path);
36 EXPECT_STREQ(fl_dart_project_get_aot_library_path(project), aot_library_path);
37}
G_MODULE_EXPORT void fl_dart_project_set_aot_library_path(FlDartProject *self, const gchar *path)

◆ TEST() [4/5]

TEST ( FlDartProjectTest  ,
OverrideAssetsPath   
)

Definition at line 39 of file fl_dart_project_test.cc.

39 {
40 g_autoptr(FlDartProject) project = fl_dart_project_new();
41
42 char assets_path[] = "/normal/tuesday/night/for/shia/labeouf";
43 fl_dart_project_set_assets_path(project, assets_path);
44 EXPECT_STREQ(fl_dart_project_get_assets_path(project), assets_path);
45}
G_MODULE_EXPORT void fl_dart_project_set_assets_path(FlDartProject *self, gchar *path)

◆ TEST() [5/5]

TEST ( FlDartProjectTest  ,
OverrideIcuDataPath   
)

Definition at line 47 of file fl_dart_project_test.cc.

47 {
48 g_autoptr(FlDartProject) project = fl_dart_project_new();
49
50 char icu_data_path[] = "/living/in/the/woods/icudtl.dat";
51 fl_dart_project_set_icu_data_path(project, icu_data_path);
52 EXPECT_STREQ(fl_dart_project_get_icu_data_path(project), icu_data_path);
53}
G_MODULE_EXPORT void fl_dart_project_set_icu_data_path(FlDartProject *self, gchar *path)