5#ifndef FLUTTER_SHELL_PLATFORM_FUCHSIA_FLUTTER_TESTS_FAKES_SCENIC_FAKE_FLATLAND_H_
6#define FLUTTER_SHELL_PLATFORM_FUCHSIA_FLUTTER_TESTS_FAKES_SCENIC_FAKE_FLATLAND_H_
8#include <fuchsia/math/cpp/fidl.h>
9#include <fuchsia/scenic/scheduling/cpp/fidl.h>
10#include <fuchsia/sysmem/cpp/fidl.h>
11#include <fuchsia/ui/composition/cpp/fidl.h>
12#include <fuchsia/ui/composition/cpp/fidl_test_base.h>
13#include <fuchsia/ui/views/cpp/fidl.h>
14#include <lib/async/dispatcher.h>
15#include <lib/fidl/cpp/binding.h>
16#include <lib/fidl/cpp/interface_request.h>
21#include <unordered_map>
24#include "flutter/fml/logging.h"
25#include "flutter/fml/macros.h"
68 :
public fuchsia::ui::composition::testing::Allocator_TestBase,
69 public fuchsia::ui::composition::testing::Flatland_TestBase {
81 const std::string&
debug_name()
const {
return debug_name_; }
90 async_dispatcher_t* dispatcher =
nullptr);
97 async_dispatcher_t* dispatcher =
nullptr);
111 fuchsia::ui::composition::OnNextFrameBeginValues
112 on_next_frame_begin_values);
118 fuchsia::scenic::scheduling::FramePresentedInfo frame_presented_info);
121 struct ParentViewportWatcher :
public fuchsia::ui::composition::testing::
122 ParentViewportWatcher_TestBase {
124 ParentViewportWatcher(
125 fuchsia::ui::views::ViewCreationToken view_token,
126 fuchsia::ui::views::ViewIdentityOnCreation view_identity,
127 fuchsia::ui::composition::ViewBoundProtocols view_protocols,
128 fidl::InterfaceRequest<fuchsia::ui::composition::ParentViewportWatcher>
129 parent_viewport_watcher,
130 async_dispatcher_t* dispatcher);
131 ParentViewportWatcher(ParentViewportWatcher&& other);
132 ~ParentViewportWatcher()
override;
135 void NotImplemented_(
const std::string&
name)
override;
138 void GetLayout(GetLayoutCallback
callback)
override;
141 void GetStatus(GetStatusCallback
callback)
override;
143 fuchsia::ui::views::ViewCreationToken view_token;
144 fuchsia::ui::views::ViewIdentityOnCreation view_identity;
145 fuchsia::ui::composition::ViewBoundProtocols view_protocols;
146 fidl::Binding<fuchsia::ui::composition::ParentViewportWatcher>
147 parent_viewport_watcher;
150 struct ChildViewWatcher
151 :
public fuchsia::ui::composition::testing::ChildViewWatcher_TestBase {
154 fuchsia::ui::views::ViewportCreationToken viewport_token,
155 fidl::InterfaceRequest<fuchsia::ui::composition::ChildViewWatcher>
157 async_dispatcher_t* dispatcher);
158 ChildViewWatcher(ChildViewWatcher&& other);
159 ~ChildViewWatcher()
override;
162 void NotImplemented_(
const std::string&
name)
override;
165 void GetStatus(GetStatusCallback
callback)
override;
167 fuchsia::ui::views::ViewportCreationToken viewport_token;
168 fidl::Binding<fuchsia::ui::composition::ChildViewWatcher>
172 struct ImageBinding {
173 fuchsia::ui::composition::BufferCollectionImportToken import_token;
176 struct BufferCollectionBinding {
177 fuchsia::ui::composition::BufferCollectionExportToken export_token;
178 fuchsia::sysmem::BufferCollectionTokenHandle sysmem_token;
180 fuchsia::ui::composition::RegisterBufferCollectionUsage
usage;
183 struct GraphBindings {
184 std::optional<std::pair<zx_koid_t, ParentViewportWatcher>> viewport_watcher;
185 std::unordered_map<zx_koid_t, ChildViewWatcher> view_watchers;
186 std::unordered_map<zx_koid_t, ImageBinding>
images;
187 std::unordered_map<zx_koid_t, BufferCollectionBinding> buffer_collections;
192 void NotImplemented_(
const std::string&
name)
override;
195 void RegisterBufferCollection(
196 fuchsia::ui::composition::RegisterBufferCollectionArgs
args,
197 RegisterBufferCollectionCallback
callback)
override;
200 void Present(fuchsia::ui::composition::PresentArgs
args)
override;
204 fuchsia::ui::views::ViewCreationToken token,
205 fidl::InterfaceRequest<fuchsia::ui::composition::ParentViewportWatcher>
206 parent_viewport_watcher)
override;
210 fuchsia::ui::views::ViewCreationToken token,
211 fuchsia::ui::views::ViewIdentityOnCreation view_identity,
212 fuchsia::ui::composition::ViewBoundProtocols view_protocols,
213 fidl::InterfaceRequest<fuchsia::ui::composition::ParentViewportWatcher>
214 parent_viewport_watcher)
override;
217 void CreateTransform(
218 fuchsia::ui::composition::TransformId transform_id)
override;
221 void SetTranslation(fuchsia::ui::composition::TransformId transform_id,
222 fuchsia::math::Vec translation)
override;
225 void SetScale(fuchsia::ui::composition::TransformId transform_id,
226 fuchsia::math::VecF
scale)
override;
230 fuchsia::ui::composition::TransformId transform_id,
231 fuchsia::ui::composition::Orientation orientation)
override;
234 void SetOpacity(fuchsia::ui::composition::TransformId transform_id,
235 float value)
override;
238 void SetClipBoundary(fuchsia::ui::composition::TransformId transform_id,
239 std::unique_ptr<fuchsia::math::Rect>
bounds)
override;
248 fuchsia::ui::composition::TransformId parent_transform_id,
249 fuchsia::ui::composition::TransformId child_transform_id)
override;
253 fuchsia::ui::composition::TransformId parent_transform_id,
254 fuchsia::ui::composition::TransformId child_transform_id)
override;
257 void SetContent(fuchsia::ui::composition::TransformId transform_id,
258 fuchsia::ui::composition::ContentId content_id)
override;
261 void SetRootTransform(
262 fuchsia::ui::composition::TransformId transform_id)
override;
266 fuchsia::ui::composition::ContentId viewport_id,
267 fuchsia::ui::views::ViewportCreationToken token,
268 fuchsia::ui::composition::ViewportProperties properties,
269 fidl::InterfaceRequest<fuchsia::ui::composition::ChildViewWatcher>
270 child_view_watcher)
override;
274 fuchsia::ui::composition::ContentId image_id,
275 fuchsia::ui::composition::BufferCollectionImportToken import_token,
277 fuchsia::ui::composition::ImageProperties properties)
override;
280 void SetImageSampleRegion(fuchsia::ui::composition::ContentId image_id,
281 fuchsia::math::RectF
rect)
override;
284 void SetImageDestinationSize(fuchsia::ui::composition::ContentId image_id,
285 fuchsia::math::SizeU
size)
override;
288 void SetImageBlendingFunction(
289 fuchsia::ui::composition::ContentId image_id,
293 void SetViewportProperties(
294 fuchsia::ui::composition::ContentId viewport_id,
295 fuchsia::ui::composition::ViewportProperties properties)
override;
298 void ReleaseTransform(
299 fuchsia::ui::composition::TransformId transform_id)
override;
302 void ReleaseViewport(fuchsia::ui::composition::ContentId viewport_id,
303 ReleaseViewportCallback
callback)
override;
306 void ReleaseImage(fuchsia::ui::composition::ContentId image_id)
override;
310 fuchsia::ui::composition::TransformId transform_id,
311 std::vector<fuchsia::ui::composition::HitRegion> regions)
override;
314 void SetInfiniteHitRegion(
315 fuchsia::ui::composition::TransformId transform_id,
316 fuchsia::ui::composition::HitTestInteraction hit_test)
override;
319 void Clear()
override;
322 void SetDebugName(std::string
debug_name)
override;
324 fidl::Binding<fuchsia::ui::composition::Allocator> allocator_binding_;
325 fidl::Binding<fuchsia::ui::composition::Flatland> flatland_binding_;
326 GraphBindings graph_bindings_;
329 FakeGraph pending_graph_;
330 FakeGraph current_graph_;
339 std::pair<std::weak_ptr<FakeTransform>, std::weak_ptr<FakeTransform>>>
342 std::string debug_name_;
fuchsia::ui::composition::FlatlandHandle ConnectFlatland(async_dispatcher_t *dispatcher=nullptr)
fuchsia::ui::composition::AllocatorHandle ConnectAllocator(async_dispatcher_t *dispatcher=nullptr)
std::function< void(fuchsia::ui::composition::PresentArgs)> PresentHandler
const FakeGraph & graph()
void SetPresentHandler(PresentHandler present_handler)
void FireOnFramePresentedEvent(fuchsia::scenic::scheduling::FramePresentedInfo frame_presented_info)
bool is_allocator_connected() const
bool is_flatland_connected() const
const std::string & debug_name() const
void FireOnNextFrameBeginEvent(fuchsia::ui::composition::OnNextFrameBeginValues on_next_frame_begin_values)
void Disconnect(fuchsia::ui::composition::FlatlandError error)
G_BEGIN_DECLS G_MODULE_EXPORT FlValue * args
FlKeyEvent uint64_t FlKeyResponderAsyncCallback callback
const uint8_t uint32_t uint32_t GError ** error
Dart_NativeFunction function
std::array< MockImage, 3 > images
Optional< SkRect > bounds
sk_sp< SkBlender > blender SkRect rect
DEF_SWITCHES_START aot vmservice shared library name
it will be possible to load the file into Perfetto s trace viewer 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
static void usage(char *argv0)
decltype(fuchsia::ui::composition::TransformId::value) TransformIdKey