5#include "flutter/lib/ui/compositing/scene_builder.h"
9#include "flutter/common/task_runners.h"
10#include "flutter/fml/synchronization/waitable_event.h"
11#include "flutter/runtime/dart_vm.h"
12#include "flutter/shell/common/shell_test.h"
13#include "flutter/shell/common/thread_host.h"
14#include "flutter/testing/testing.h"
23 auto message_latch = std::make_shared<fml::AutoResetWaitableEvent>();
27 Scene* retained_scene;
29 auto validate_builder_has_layers =
36 retained_scene_builder =
reinterpret_cast<SceneBuilder*
>(peer);
37 retained_scene_builder->
AddRef();
38 ASSERT_TRUE(retained_scene_builder);
39 ASSERT_EQ(retained_scene_builder->
layer_stack().size(), 2ul);
42 auto validate_builder_has_no_layers =
44 ASSERT_EQ(retained_scene_builder->
layer_stack().size(), 0ul);
45 retained_scene_builder->
Release();
46 retained_scene_builder =
nullptr;
55 retained_scene =
reinterpret_cast<Scene*
>(peer);
57 ASSERT_TRUE(retained_scene);
60 auto validate_scene_has_no_layers =
64 retained_scene =
nullptr;
65 message_latch->Signal();
76 AddNativeCallback(
"ValidateBuilderHasLayers",
78 AddNativeCallback(
"ValidateBuilderHasNoLayers",
82 AddNativeCallback(
"ValidateSceneHasNoLayers",
85 std::unique_ptr<Shell>
shell = CreateShell(
settings, task_runners);
87 ASSERT_TRUE(
shell->IsSetup());
89 configuration.SetEntrypoint(
"validateSceneBuilderAndScene");
91 shell->RunEngine(std::move(configuration), [](
auto result) {
95 message_latch->Wait();
96 DestroyShell(std::move(
shell), task_runners);
100 auto message_latch = std::make_shared<fml::AutoResetWaitableEvent>();
102 std::shared_ptr<ContainerLayer> root_layer;
111 ASSERT_TRUE(scene_builder);
113 ASSERT_TRUE(root_layer);
118 EXPECT_EQ(root_layer->layers().front().use_count(), 2);
121 auto validate_engine_layer_dispose =
124 EXPECT_EQ(root_layer->layers().front().use_count(), 1);
126 message_latch->Signal();
137 AddNativeCallback(
"CaptureRootLayer",
139 AddNativeCallback(
"ValidateLayerTreeCounts",
141 AddNativeCallback(
"ValidateEngineLayerDispose",
144 std::unique_ptr<Shell>
shell = CreateShell(
settings, task_runners);
146 ASSERT_TRUE(
shell->IsSetup());
148 configuration.SetEntrypoint(
"validateEngineLayerDispose");
150 shell->RunEngine(std::move(configuration), [](
auto result) {
154 message_latch->Wait();
155 DestroyShell(std::move(
shell), task_runners);
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::vector< std::shared_ptr< ContainerLayer > > & layer_stack()
std::unique_ptr< flutter::LayerTree > takeLayerTree(uint64_t width, uint64_t height)
struct _Dart_Handle * Dart_Handle
DART_EXPORT Dart_Handle Dart_GetNativeArgument(Dart_NativeArguments args, int index)
DART_EXPORT Dart_Handle Dart_GetNativeInstanceField(Dart_Handle obj, int index, intptr_t *value)
struct _Dart_NativeArguments * Dart_NativeArguments
DART_EXPORT bool Dart_IsError(Dart_Handle handle)
G_BEGIN_DECLS G_MODULE_EXPORT FlValue * args
fml::RefPtr< fml::TaskRunner > CreateNewThread(const std::string &name)
fml::RefPtr< fml::TaskRunner > GetCurrentTaskRunner()
TEST_F(DisplayListTest, Defaults)
#define CREATE_NATIVE_ENTRY(native_entry)