Flutter Engine
The Flutter Engine
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
flutter_runner_test::AccessibilityBridgeTest Class Reference
Inheritance diagram for flutter_runner_test::AccessibilityBridgeTest:

Public Member Functions

 AccessibilityBridgeTest ()
 
void RunLoopUntilIdle ()
 
void RunPromiseToCompletion (fpromise::promise<> promise)
 

Protected Member Functions

void SetUp () override
 
void TearDown () override
 

Protected Attributes

MockSemanticsManager semantics_manager_
 
AccessibilityBridgeTestDelegate accessibility_delegate_
 
std::unique_ptr< flutter_runner::AccessibilityBridgeaccessibility_bridge_
 
std::unique_ptr< inspect::Inspector > inspector_
 

Detailed Description

Definition at line 59 of file accessibility_bridge_unittest.cc.

Constructor & Destructor Documentation

◆ AccessibilityBridgeTest()

flutter_runner_test::AccessibilityBridgeTest::AccessibilityBridgeTest ( )
inline

Definition at line 61 of file accessibility_bridge_unittest.cc.

62 : loop_(&kAsyncLoopConfigAttachToCurrentThread),
63 services_provider_(loop_.dispatcher()),
64 executor_(loop_.dispatcher()) {
65 services_provider_.AddService(
66 semantics_manager_.GetHandler(loop_.dispatcher()),
67 SemanticsManager::Name_);
68 }
fidl::InterfaceRequestHandler< SemanticsManager > GetHandler(async_dispatcher_t *dispatcher)

Member Function Documentation

◆ RunLoopUntilIdle()

void flutter_runner_test::AccessibilityBridgeTest::RunLoopUntilIdle ( )
inline

Definition at line 70 of file accessibility_bridge_unittest.cc.

70 {
71 loop_.RunUntilIdle();
72 loop_.ResetQuit();
73 }

◆ RunPromiseToCompletion()

void flutter_runner_test::AccessibilityBridgeTest::RunPromiseToCompletion ( fpromise::promise<>  promise)
inline

Definition at line 75 of file accessibility_bridge_unittest.cc.

75 {
76 bool done = false;
77 executor_.schedule_task(
78 std::move(promise).and_then([&done]() { done = true; }));
79 while (loop_.GetState() == ASYNC_LOOP_RUNNABLE) {
80 if (done) {
81 loop_.ResetQuit();
82 return;
83 }
84
85 loop_.Run(zx::deadline_after(zx::duration::infinite()), true);
86 }
87 loop_.ResetQuit();
88 }
static void done(const char *config, const char *src, const char *srcOptions, const char *name)
Definition: DM.cpp:263

◆ SetUp()

void flutter_runner_test::AccessibilityBridgeTest::SetUp ( )
inlineoverrideprotected

Definition at line 91 of file accessibility_bridge_unittest.cc.

91 {
92 // Connect to SemanticsManager service.
93 fuchsia::accessibility::semantics::SemanticsManagerHandle semantics_manager;
94 zx_status_t semantics_status =
95 services_provider_.service_directory()
96 ->Connect<fuchsia::accessibility::semantics::SemanticsManager>(
97 semantics_manager.NewRequest());
98 if (semantics_status != ZX_OK) {
99 FML_LOG(WARNING)
100 << "fuchsia::accessibility::semantics::SemanticsManager connection "
101 "failed: "
102 << zx_status_get_string(semantics_status);
103 }
104
106 inspector_ = std::make_unique<inspect::Inspector>();
108 set_semantics_enabled_callback = [this](bool enabled) {
110 };
112 dispatch_semantics_action_callback =
113 [this](int32_t node_id, flutter::SemanticsAction action) {
115 };
116
117 fuchsia::ui::views::ViewRefControl view_ref_control;
118 fuchsia::ui::views::ViewRef view_ref;
119 auto status = zx::eventpair::create(
120 /*options*/ 0u, &view_ref_control.reference, &view_ref.reference);
121 ASSERT_EQ(status, ZX_OK);
122 view_ref_control.reference.replace(
123 ZX_DEFAULT_EVENTPAIR_RIGHTS & (~ZX_RIGHT_DUPLICATE),
124 &view_ref_control.reference);
125 view_ref.reference.replace(ZX_RIGHTS_BASIC, &view_ref.reference);
127 std::make_unique<flutter_runner::AccessibilityBridge>(
128 std::move(set_semantics_enabled_callback),
129 std::move(dispatch_semantics_action_callback),
130 std::move(semantics_manager), std::move(view_ref),
131 inspector_->GetRoot().CreateChild("test_node"));
132
134 }
std::function< void(bool)> SetSemanticsEnabledCallback
std::function< void(int32_t, flutter::SemanticsAction)> DispatchSemanticsActionCallback
std::vector< std::pair< int32_t, flutter::SemanticsAction > > actions
void DispatchSemanticsAction(int32_t node_id, flutter::SemanticsAction action)
std::unique_ptr< flutter_runner::AccessibilityBridge > accessibility_bridge_
#define FML_LOG(severity)
Definition: logging.h:82
int_closure create

◆ TearDown()

void flutter_runner_test::AccessibilityBridgeTest::TearDown ( )
inlineoverrideprotected

Member Data Documentation

◆ accessibility_bridge_

std::unique_ptr<flutter_runner::AccessibilityBridge> flutter_runner_test::AccessibilityBridgeTest::accessibility_bridge_
protected

Definition at line 140 of file accessibility_bridge_unittest.cc.

◆ accessibility_delegate_

AccessibilityBridgeTestDelegate flutter_runner_test::AccessibilityBridgeTest::accessibility_delegate_
protected

Definition at line 139 of file accessibility_bridge_unittest.cc.

◆ inspector_

std::unique_ptr<inspect::Inspector> flutter_runner_test::AccessibilityBridgeTest::inspector_
protected

Definition at line 142 of file accessibility_bridge_unittest.cc.

◆ semantics_manager_

MockSemanticsManager flutter_runner_test::AccessibilityBridgeTest::semantics_manager_
protected

Definition at line 138 of file accessibility_bridge_unittest.cc.


The documentation for this class was generated from the following file: