Flutter Engine
The Flutter Engine
test_ax_tree_manager.cc
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
6
7#include "ax_node.h"
8#include "ax_tree_data.h"
10
11namespace ui {
12
14
15TestAXTreeManager::TestAXTreeManager(std::unique_ptr<AXTree> tree)
16 : tree_(std::move(tree)) {
18}
19
21 if (tree_)
23}
24
26 if (!tree_)
27 return;
28
30 tree_.reset();
31}
32
34 if (!tree_) {
35 BASE_LOG() << "Did you forget to call SetTree?";
37 }
38 return tree_.get();
39}
40
41void TestAXTreeManager::SetTree(std::unique_ptr<AXTree> tree) {
42 if (tree_)
44
45 tree_ = std::move(tree);
47}
48
50 const AXNode::AXID node_id) const {
51 return (tree_ && GetTreeID() == tree_id) ? tree_->GetFromId(node_id)
52 : nullptr;
53}
54
56 return tree_ ? tree_->GetFromId(node_id) : nullptr;
57}
58
60 return tree_ ? tree_->data().tree_id : AXTreeIDUnknown();
61}
62
64 return AXTreeIDUnknown();
65}
66
68 return tree_ ? tree_->root() : nullptr;
69}
70
72 return nullptr;
73}
74
75} // namespace ui
int32_t AXID
Definition: ax_node.h:36
void AddTreeManager(AXTreeID tree_id, AXTreeManager *manager)
static AXTreeManagerMap & GetInstance()
void RemoveTreeManager(AXTreeID tree_id)
AXNode * GetParentNodeFromParentTreeAsAXNode() const override
AXNode * GetNodeFromTree(const AXTreeID tree_id, const AXNode::AXID node_id) const override
AXTreeID GetTreeID() const override
void SetTree(std::unique_ptr< AXTree > tree)
AXTreeID GetParentTreeID() const override
AXNode * GetRootAsAXNode() const override
Definition: ref_ptr.h:256
const AXTreeID & AXTreeIDUnknown()
Definition: ax_tree_id.cc:103
#define BASE_UNREACHABLE()
Definition: logging.h:69
#define BASE_LOG()
Definition: logging.h:54