src/ui/a11y/bin/a11y_manager/tests/app_unittest.cc
// Test to make sure ViewManager Service is exposed by A11y.
// Test sends a node update to ViewManager and then compare the expected
// result using log file created by semantics manager.
Test to make sure ViewManager Service is exposed by A11y.
Test sends a node update to ViewManager and then compare the expected
result using log file created by semantics manager.
Test to make sure ViewManager Service is exposed by A11y . Test sends a node update to ViewManager and then compare the expected result using log file created by semantics manager .
TEST_F(AppUnitTest, UpdateNodeToSemanticsManager) {
  fuchsia::ui::views::ViewRef view_ref_connection;
  fidl::Clone(view_ref_, &view_ref_connection);
  fuchsia::settings::AccessibilitySettings settings;
  settings.set_screen_reader(true);
  mock_setui_.Set(std::move(settings), [](auto) {});
  accessibility_test::MockSemanticListener semantic_listener(&context_provider_,
                                                             std::move(view_ref_connection));
  RunLoopUntilIdle();
  std::vector<Node> update_nodes;
  Node node = CreateTestNode(0, "Label A");
  Node clone_node;
  node.Clone(&clone_node);
  update_nodes.push_back(std::move(clone_node));
  semantic_listener.UpdateSemanticNodes(std::move(update_nodes));
  RunLoopUntilIdle();
  semantic_listener.CommitUpdates();
  RunLoopUntilIdle();
  auto created_node = view_manager_.GetSemanticNode(a11y::GetKoid(view_ref_), 0u);
  EXPECT_TRUE(created_node);
  EXPECT_EQ(created_node->attributes().label(), "Label A");
  vfs::PseudoDir* debug_dir = context_->outgoing()->debug_dir();
  vfs::internal::Node* test_node;
  EXPECT_EQ(ZX_OK, debug_dir->Lookup(std::to_string(a11y::GetKoid(view_ref_)), &test_node));
}
TEST_F ( AppUnitTest , UpdateNodeToSemanticsManager ) { fuchsia :: ui :: views :: ViewRef view_ref_connection ; fidl :: Clone ( view_ref_ , & view_ref_connection ) ; fuchsia :: settings :: AccessibilitySettings settings ; settings . set_screen_reader ( true ) ; mock_setui_ . Set ( std :: move ( settings ) , [ ] ( auto ) { } ) ; accessibility_test :: MockSemanticListener semantic_listener ( & context_provider_ , std :: move ( view_ref_connection ) ) ; RunLoopUntilIdle ( ) ; std :: vector < Node > update_nodes ; Node node = CreateTestNode ( 0 , " " ) ; Node clone_node ; node . Clone ( & clone_node ) ; update_nodes . push_back ( std :: move ( clone_node ) ) ; semantic_listener . UpdateSemanticNodes ( std :: move ( update_nodes ) ) ; RunLoopUntilIdle ( ) ; semantic_listener . CommitUpdates ( ) ; RunLoopUntilIdle ( ) ; auto created_node = view_manager_ . GetSemanticNode ( a11y :: GetKoid ( view_ref_ ) , 0u ) ; EXPECT_TRUE ( created_node ) ; EXPECT_EQ ( created_node -> attributes ( ) . label ( ) , " " ) ; vfs :: PseudoDir * debug_dir = context_ -> outgoing ( ) -> debug_dir ( ) ; vfs :: internal :: Node * test_node ; EXPECT_EQ ( ZX_OK , debug_dir -> Lookup ( std :: to_string ( a11y :: GetKoid ( view_ref_ ) ) , & test_node ) ) ; }
Test to make sure ViewManager Service is exposed by A11y.
Test to make sure ViewManager Service is exposed by A11y .
// Create ViewRef. // Turn on the screen reader. // Create ActionListener. // We make sure the Semantic Listener has finished connecting to the // root. // Creating test node to update. // Update the node created above. // Commit nodes. // Check that the node is in the semantic tree // Check that the committed node is present in the logs