Flutter Engine
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 58 of file accessibility_bridge_unittest.cc.

Constructor & Destructor Documentation

◆ AccessibilityBridgeTest()

flutter_runner_test::AccessibilityBridgeTest::AccessibilityBridgeTest ( )
inline

Definition at line 60 of file accessibility_bridge_unittest.cc.

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

Member Function Documentation

◆ RunLoopUntilIdle()

void flutter_runner_test::AccessibilityBridgeTest::RunLoopUntilIdle ( )
inline

Definition at line 69 of file accessibility_bridge_unittest.cc.

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

◆ RunPromiseToCompletion()

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

Definition at line 74 of file accessibility_bridge_unittest.cc.

74  {
75  bool done = false;
76  executor_.schedule_task(
77  std::move(promise).and_then([&done]() { done = true; }));
78  while (loop_.GetState() == ASYNC_LOOP_RUNNABLE) {
79  if (done) {
80  loop_.ResetQuit();
81  return;
82  }
83 
84  loop_.Run(zx::deadline_after(zx::duration::infinite()), true);
85  }
86  loop_.ResetQuit();
87  }

◆ SetUp()

void flutter_runner_test::AccessibilityBridgeTest::SetUp ( )
inlineoverrideprotected

Definition at line 90 of file accessibility_bridge_unittest.cc.

References action, flutter_runner_test::AccessibilityBridgeTestDelegate::enabled(), and FML_LOG.

90  {
91  // Connect to SemanticsManager service.
92  fuchsia::accessibility::semantics::SemanticsManagerHandle semantics_manager;
93  zx_status_t semantics_status =
94  services_provider_.service_directory()
95  ->Connect<fuchsia::accessibility::semantics::SemanticsManager>(
96  semantics_manager.NewRequest());
97  if (semantics_status != ZX_OK) {
98  FML_LOG(WARNING)
99  << "fuchsia::accessibility::semantics::SemanticsManager connection "
100  "failed: "
101  << zx_status_get_string(semantics_status);
102  }
103 
105  inspector_ = std::make_unique<inspect::Inspector>();
107  set_semantics_enabled_callback = [this](bool enabled) {
109  };
111  dispatch_semantics_action_callback =
112  [this](int32_t node_id, flutter::SemanticsAction action) {
114  };
115  auto [view_ref_control, view_ref] = scenic::ViewRefPair::New();
117  std::make_unique<flutter_runner::AccessibilityBridge>(
118  std::move(set_semantics_enabled_callback),
119  std::move(dispatch_semantics_action_callback),
120  std::move(semantics_manager), std::move(view_ref),
121  inspector_->GetRoot().CreateChild("test_node"));
122 
124  }
#define FML_LOG(severity)
Definition: logging.h:65
std::unique_ptr< flutter_runner::AccessibilityBridge > accessibility_bridge_
void DispatchSemanticsAction(int32_t node_id, flutter::SemanticsAction action)
SemanticsAction action
std::function< void(bool)> SetSemanticsEnabledCallback
std::function< void(int32_t, flutter::SemanticsAction)> DispatchSemanticsActionCallback
std::vector< std::pair< int32_t, flutter::SemanticsAction > > actions

◆ 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 130 of file accessibility_bridge_unittest.cc.

◆ accessibility_delegate_

AccessibilityBridgeTestDelegate flutter_runner_test::AccessibilityBridgeTest::accessibility_delegate_
protected

Definition at line 129 of file accessibility_bridge_unittest.cc.

◆ inspector_

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

Definition at line 132 of file accessibility_bridge_unittest.cc.

◆ semantics_manager_

MockSemanticsManager flutter_runner_test::AccessibilityBridgeTest::semantics_manager_
protected

Definition at line 128 of file accessibility_bridge_unittest.cc.


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