5#ifndef FLUTTER_SHELL_PLATFORM_FUCHSIA_FLUTTER_FLUTTER_RUNNER_FAKES_H_
6#define FLUTTER_SHELL_PLATFORM_FUCHSIA_FLUTTER_FLUTTER_RUNNER_FAKES_H_
8#include <fuchsia/accessibility/semantics/cpp/fidl.h>
11using fuchsia::accessibility::semantics::SemanticsManager;
14 :
public SemanticsManager,
15 public fuchsia::accessibility::semantics::SemanticTree {
21 fuchsia::ui::views::ViewRef view_ref,
22 fuchsia::accessibility::semantics::SemanticListenerHandle handle,
23 fidl::InterfaceRequest<fuchsia::accessibility::semantics::SemanticTree>
24 semantic_tree)
override {
25 tree_binding_.Bind(std::move(semantic_tree));
29 fidl::InterfaceRequestHandler<SemanticsManager>
GetHandler(
30 async_dispatcher_t* dispatcher) {
31 return bindings_.GetHandler(
this, dispatcher);
40 last_updated_nodes_.clear();
41 last_deleted_node_ids_.clear();
42 delete_overflowed_ =
false;
43 update_overflowed_ =
false;
47 std::vector<fuchsia::accessibility::semantics::Node> nodes)
override {
49 if (!update_overflowed_) {
51 for (
const auto& node : nodes) {
53 size +=
sizeof(node.attributes().label().size());
55 update_overflowed_ = size > ZX_CHANNEL_MAX_MSG_BYTES;
57 last_updated_nodes_ = std::move(nodes);
62 if (!delete_overflowed_) {
66 delete_overflowed_ = size > ZX_CHANNEL_MAX_MSG_BYTES;
68 last_deleted_node_ids_ = std::move(node_ids);
72 return last_deleted_node_ids_;
84 should_hold_commit_response_ =
value;
88 if (commit_callback_) {
97 return last_updated_nodes_;
102 if (should_hold_commit_response_) {
103 commit_callback_ = std::move(
callback);
110 fuchsia::accessibility::semantics::SemanticEvent semantic_event,
111 SendSemanticEventCallback
callback)
override {
112 last_events_.emplace_back(std::move(semantic_event));
116 std::vector<fuchsia::accessibility::semantics::SemanticEvent>&
122 bool has_view_ref_ =
false;
123 fidl::BindingSet<SemanticsManager> bindings_;
124 fidl::Binding<SemanticTree> tree_binding_;
126 std::vector<fuchsia::accessibility::semantics::Node> last_updated_nodes_;
127 bool update_overflowed_;
130 bool delete_overflowed_;
131 std::vector<uint32_t> last_deleted_node_ids_;
132 bool should_hold_commit_response_ =
false;
133 CommitUpdatesCallback commit_callback_;
135 std::vector<fuchsia::accessibility::semantics::SemanticEvent> last_events_;
static constexpr size_t kNodeIdSize
const std::vector< fuchsia::accessibility::semantics::Node > & LastUpdatedNodes() const
void SendSemanticEvent(fuchsia::accessibility::semantics::SemanticEvent semantic_event, SendSemanticEventCallback callback) override
const std::vector< uint32_t > & LastDeletedNodeIds() const
std::vector< fuchsia::accessibility::semantics::SemanticEvent > & GetLastEvents()
fidl::InterfaceRequestHandler< SemanticsManager > GetHandler(async_dispatcher_t *dispatcher)
bool UpdateOverflowed() const
void InvokeCommitCallback()
void DeleteSemanticNodes(std::vector< uint32_t > node_ids) override
void RegisterViewForSemantics(fuchsia::ui::views::ViewRef view_ref, fuchsia::accessibility::semantics::SemanticListenerHandle handle, fidl::InterfaceRequest< fuchsia::accessibility::semantics::SemanticTree > semantic_tree) override
void SetShouldHoldCommitResponse(bool value)
bool ShouldHoldCommitResponse() const
void UpdateSemanticNodes(std::vector< fuchsia::accessibility::semantics::Node > nodes) override
bool RegisterViewCalled()
void CommitUpdates(CommitUpdatesCallback callback) override
bool DeleteOverflowed() const
FlKeyEvent uint64_t FlKeyResponderAsyncCallback callback