Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
test_ax_tree_manager.h
Go to the documentation of this file.
1// Copyright 2020 The Chromium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef ACCESSIBILITY_TEST_AX_AX_TREE_MANAGER_H_
6#define ACCESSIBILITY_TEST_AX_AX_TREE_MANAGER_H_
7
8#include <memory>
9
10#include "ax_tree.h"
11#include "ax_tree_id.h"
12#include "ax_tree_manager.h"
13
14namespace ui {
15
16class AXNode;
17
18// A basic implementation of AXTreeManager that can be used in tests.
19//
20// For simplicity, this class supports only a single tree and doesn't perform
21// any walking across multiple trees.
23 public:
24 // This constructor does not create an empty AXTree. Call "SetTree" if you
25 // need to manage a specific tree. Useful when you need to test for the
26 // situation when no AXTree has been loaded yet.
28
29 // Takes ownership of |tree|.
30 explicit TestAXTreeManager(std::unique_ptr<AXTree> tree);
31
32 virtual ~TestAXTreeManager();
33
34 TestAXTreeManager(const TestAXTreeManager& manager) = delete;
36
37 void DestroyTree();
38 AXTree* GetTree() const;
39 // Takes ownership of |tree|.
40 void SetTree(std::unique_ptr<AXTree> tree);
41
42 // AXTreeManager implementation.
43 AXNode* GetNodeFromTree(const AXTreeID tree_id,
44 const AXNode::AXID node_id) const override;
45 AXNode* GetNodeFromTree(const AXNode::AXID node_id) const override;
46 AXTreeID GetTreeID() const override;
47 AXTreeID GetParentTreeID() const override;
48 AXNode* GetRootAsAXNode() const override;
50
51 private:
52 std::unique_ptr<AXTree> tree_;
53};
54
55} // namespace ui
56
57#endif // ACCESSIBILITY_TEST_AX_AX_TREE_MANAGER_H_
int32_t AXID
Definition ax_node.h:36
AXNode * GetParentNodeFromParentTreeAsAXNode() const override
AXNode * GetNodeFromTree(const AXTreeID tree_id, const AXNode::AXID node_id) const override
AXTreeID GetTreeID() const override
TestAXTreeManager & operator=(const TestAXTreeManager &manager)=delete
TestAXTreeManager(const TestAXTreeManager &manager)=delete
void SetTree(std::unique_ptr< AXTree > tree)
AXTreeID GetParentTreeID() const override
AXNode * GetRootAsAXNode() const override