27 const std::string& expected) {
28 std::string data_string(
reinterpret_cast<const char*
>(
data->bytes()),
30 ASSERT_EQ(data_string, expected);
40 ASSERT_EQ(shaders.size(), 2u);
53 const std::string kTestJson =
56 " \"IE\": \"eA==\",\n"
64 auto data = std::make_unique<fml::DataMapping>(
65 std::vector<uint8_t>{kTestJson.begin(), kTestJson.end()});
70 auto settings = CreateSettingsForFixture();
71 settings.assets_path = asset_dir.
path();
78 auto asset_manager = std::make_shared<AssetManager>();
80 asset_manager->PushBack(std::make_unique<DirectoryAssetBundle>(
89 ASSERT_EQ(shaders.size(), 2u);
93 if (shaders[0].
key->bytes()[0] ==
'B') {
94 std::swap(shaders[0], shaders[1]);
112 {
"flutter_engine", GetFlutterEngineVersion(),
"skia"},
115 constexpr char kOldEngineVersion[] =
"old";
117 base_dir.
fd(), {
"flutter_engine", kOldEngineVersion,
"skia"},
119 ASSERT_TRUE(old_created.is_valid());
129 ASSERT_TRUE(engine_dir.is_valid());
130 ASSERT_TRUE(current_dir.is_valid());
131 ASSERT_FALSE(old_dir.is_valid());
142 {
"flutter_engine", GetFlutterEngineVersion(),
"skia", GetSkiaVersion()},
151 ASSERT_TRUE(file.is_valid());
154 auto settings = CreateSettingsForFixture();
155 settings.purge_persistent_cache =
true;
157 std::unique_ptr<Shell> shell = CreateShell(settings);
158 RunEngine(shell.get(), std::move(config));
162 ASSERT_FALSE(file.is_valid());
166 DestroyShell(std::move(shell));
170 sk_sp<SkData> shader_key = SkData::MakeWithCString(
"key");
171 sk_sp<SkData> shader_value = SkData::MakeWithCString(
"value");
180 auto settings = CreateSettingsForFixture();
181 settings.purge_persistent_cache =
true;
182 settings.cache_sksl =
true;
184 std::unique_ptr<Shell> shell = CreateShell(settings);
185 RunEngine(shell.get(), std::move(config));
187 ASSERT_EQ(persistent_cache->LoadSkSLs().size(), 0u);
190 StorePersistentCache(persistent_cache, *shader_key, *shader_value);
191 std::promise<bool> io_flushed;
192 shell->GetTaskRunners().GetIOTaskRunner()->PostTask(
193 [&io_flushed]() { io_flushed.set_value(
true); });
194 io_flushed.get_future().get();
195 ASSERT_GT(persistent_cache->LoadSkSLs().size(), 0u);
199 DestroyShell(std::move(shell));
static void SetAssetManager(std::shared_ptr< AssetManager > value)
static void SetCacheDirectoryPath(std::string path)
static PersistentCache * GetCacheForProcess()
static constexpr char kAssetFileName[]
static void ResetCacheForProcess()
std::vector< SkSLCache > LoadSkSLs() const
Load all the SkSL shader caches in the right directory.
static std::string SkKeyToFilePath(const SkData &key)
Specifies all the configuration required by the runtime library to launch the root isolate....
static RunConfiguration InferFromSettings(const Settings &settings, const fml::RefPtr< fml::TaskRunner > &io_worker=nullptr, IsolateLaunchType launch_type=IsolateLaunchType::kNewGroup)
Attempts to infer a run configuration from the settings object. This tries to create a run configurat...
const std::string & path() const
TEST_F(DisplayListTest, Defaults)
static void CheckTextSkData(const sk_sp< SkData > &data, const std::string &expected)
static void CheckTwoSkSLsAreLoaded()
static void ResetAssetManager()
it will be possible to load the file into Perfetto s trace viewer use test Running tests that layout and measure text will not yield consistent results across various platforms Enabling this option will make font resolution default to the Ahem test font on all disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive keep the shell running after the Dart script has completed enable serial On low power devices with low core running concurrent GC tasks on threads can cause them to contend with the UI thread which could potentially lead to jank This option turns off all concurrent GC activities domain network JSON encoded network policy per domain This overrides the DisallowInsecureConnections switch Embedder can specify whether to allow or disallow insecure connections at a domain level old gen heap size
const char * GetFlutterEngineVersion()
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot data
fml::UniqueFD OpenFileReadOnly(const fml::UniqueFD &base_directory, const char *path)
bool RemoveFilesInDirectory(const fml::UniqueFD &directory)
bool WriteAtomically(const fml::UniqueFD &base_directory, const char *file_name, const Mapping &mapping)
fml::UniqueFD OpenDirectoryReadOnly(const fml::UniqueFD &base_directory, const char *path)
fml::UniqueFD OpenDirectory(const char *path, bool create_if_necessary, FilePermission permission)
static fml::UniqueFD CreateDirectory(const fml::UniqueFD &base_directory, const std::vector< std::string > &components, FilePermission permission, size_t index)
constexpr LogSeverity kLogWarning
bool UnlinkFile(const char *path)