OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
| 5 #include <stddef.h> |
| 6 #include <stdint.h> |
| 7 |
5 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
6 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
7 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
8 #include "ui/accessibility/ax_node.h" | 11 #include "ui/accessibility/ax_node.h" |
9 #include "ui/accessibility/ax_serializable_tree.h" | 12 #include "ui/accessibility/ax_serializable_tree.h" |
10 #include "ui/accessibility/ax_tree.h" | 13 #include "ui/accessibility/ax_tree.h" |
11 #include "ui/accessibility/ax_tree_serializer.h" | 14 #include "ui/accessibility/ax_tree_serializer.h" |
12 | 15 |
13 namespace ui { | 16 namespace ui { |
14 | 17 |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 break; | 59 break; |
57 case NODE_CHANGED: | 60 case NODE_CHANGED: |
58 change_finished_ids_.push_back(id); | 61 change_finished_ids_.push_back(id); |
59 break; | 62 break; |
60 } | 63 } |
61 } | 64 } |
62 } | 65 } |
63 | 66 |
64 bool tree_data_changed() const { return tree_data_changed_; } | 67 bool tree_data_changed() const { return tree_data_changed_; } |
65 bool root_changed() const { return root_changed_; } | 68 bool root_changed() const { return root_changed_; } |
66 const std::vector<int32>& deleted_ids() { return deleted_ids_; } | 69 const std::vector<int32_t>& deleted_ids() { return deleted_ids_; } |
67 const std::vector<int32>& subtree_deleted_ids() { | 70 const std::vector<int32_t>& subtree_deleted_ids() { |
68 return subtree_deleted_ids_; | 71 return subtree_deleted_ids_; |
69 } | 72 } |
70 const std::vector<int32>& created_ids() { return created_ids_; } | 73 const std::vector<int32_t>& created_ids() { return created_ids_; } |
71 const std::vector<int32>& node_creation_finished_ids() { | 74 const std::vector<int32_t>& node_creation_finished_ids() { |
72 return node_creation_finished_ids_; | 75 return node_creation_finished_ids_; |
73 } | 76 } |
74 const std::vector<int32>& subtree_creation_finished_ids() { | 77 const std::vector<int32_t>& subtree_creation_finished_ids() { |
75 return subtree_creation_finished_ids_; | 78 return subtree_creation_finished_ids_; |
76 } | 79 } |
77 const std::vector<int32>& change_finished_ids() { | 80 const std::vector<int32_t>& change_finished_ids() { |
78 return change_finished_ids_; | 81 return change_finished_ids_; |
79 } | 82 } |
80 | 83 |
81 private: | 84 private: |
82 bool tree_data_changed_; | 85 bool tree_data_changed_; |
83 bool root_changed_; | 86 bool root_changed_; |
84 std::vector<int32> deleted_ids_; | 87 std::vector<int32_t> deleted_ids_; |
85 std::vector<int32> subtree_deleted_ids_; | 88 std::vector<int32_t> subtree_deleted_ids_; |
86 std::vector<int32> created_ids_; | 89 std::vector<int32_t> created_ids_; |
87 std::vector<int32> changed_ids_; | 90 std::vector<int32_t> changed_ids_; |
88 std::vector<int32> node_creation_finished_ids_; | 91 std::vector<int32_t> node_creation_finished_ids_; |
89 std::vector<int32> subtree_creation_finished_ids_; | 92 std::vector<int32_t> subtree_creation_finished_ids_; |
90 std::vector<int32> change_finished_ids_; | 93 std::vector<int32_t> change_finished_ids_; |
91 }; | 94 }; |
92 | 95 |
93 } // namespace | 96 } // namespace |
94 | 97 |
95 TEST(AXTreeTest, SerializeSimpleAXTree) { | 98 TEST(AXTreeTest, SerializeSimpleAXTree) { |
96 AXNodeData root; | 99 AXNodeData root; |
97 root.id = 1; | 100 root.id = 1; |
98 root.role = AX_ROLE_ROOT_WEB_AREA; | 101 root.role = AX_ROLE_ROOT_WEB_AREA; |
99 root.state = (1 << AX_STATE_FOCUSABLE) | (1 << AX_STATE_FOCUSED); | 102 root.state = (1 << AX_STATE_FOCUSABLE) | (1 << AX_STATE_FOCUSED); |
100 root.location = gfx::Rect(0, 0, 800, 600); | 103 root.location = gfx::Rect(0, 0, 800, 600); |
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
389 tree_data_update.has_tree_data = true; | 392 tree_data_update.has_tree_data = true; |
390 tree_data_update.tree_data.title = "New Title"; | 393 tree_data_update.tree_data.title = "New Title"; |
391 EXPECT_TRUE(tree.Unserialize(tree_data_update)); | 394 EXPECT_TRUE(tree.Unserialize(tree_data_update)); |
392 EXPECT_TRUE(fake_delegate.tree_data_changed()); | 395 EXPECT_TRUE(fake_delegate.tree_data_changed()); |
393 EXPECT_EQ("New Title", tree.data().title); | 396 EXPECT_EQ("New Title", tree.data().title); |
394 | 397 |
395 tree.SetDelegate(NULL); | 398 tree.SetDelegate(NULL); |
396 } | 399 } |
397 | 400 |
398 } // namespace ui | 401 } // namespace ui |
OLD | NEW |