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 "base/memory/scoped_ptr.h" | 5 #include "base/memory/scoped_ptr.h" |
6 #include "base/strings/string_number_conversions.h" | 6 #include "base/strings/string_number_conversions.h" |
7 #include "testing/gtest/include/gtest/gtest.h" | 7 #include "testing/gtest/include/gtest/gtest.h" |
8 #include "ui/accessibility/ax_node.h" | 8 #include "ui/accessibility/ax_node.h" |
9 #include "ui/accessibility/ax_serializable_tree.h" | 9 #include "ui/accessibility/ax_serializable_tree.h" |
10 #include "ui/accessibility/ax_tree.h" | 10 #include "ui/accessibility/ax_tree.h" |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 AXTreeUpdate initial_state; | 107 AXTreeUpdate initial_state; |
108 initial_state.nodes.push_back(root); | 108 initial_state.nodes.push_back(root); |
109 initial_state.nodes.push_back(button); | 109 initial_state.nodes.push_back(button); |
110 initial_state.nodes.push_back(checkbox); | 110 initial_state.nodes.push_back(checkbox); |
111 AXSerializableTree src_tree(initial_state); | 111 AXSerializableTree src_tree(initial_state); |
112 | 112 |
113 scoped_ptr<AXTreeSource<const AXNode*> > tree_source( | 113 scoped_ptr<AXTreeSource<const AXNode*> > tree_source( |
114 src_tree.CreateTreeSource()); | 114 src_tree.CreateTreeSource()); |
115 AXTreeSerializer<const AXNode*> serializer(tree_source.get()); | 115 AXTreeSerializer<const AXNode*> serializer(tree_source.get()); |
116 AXTreeUpdate update; | 116 AXTreeUpdate update; |
117 serializer.SerializeChanges(src_tree.GetRoot(), &update); | 117 serializer.SerializeChanges(src_tree.root(), &update); |
118 | 118 |
119 AXTree dst_tree; | 119 AXTree dst_tree; |
120 ASSERT_TRUE(dst_tree.Unserialize(update)); | 120 ASSERT_TRUE(dst_tree.Unserialize(update)); |
121 | 121 |
122 const AXNode* root_node = dst_tree.GetRoot(); | 122 const AXNode* root_node = dst_tree.root(); |
123 ASSERT_TRUE(root_node != NULL); | 123 ASSERT_TRUE(root_node != NULL); |
124 EXPECT_EQ(root.id, root_node->id()); | 124 EXPECT_EQ(root.id, root_node->id()); |
125 EXPECT_EQ(root.role, root_node->data().role); | 125 EXPECT_EQ(root.role, root_node->data().role); |
126 | 126 |
127 ASSERT_EQ(2, root_node->child_count()); | 127 ASSERT_EQ(2, root_node->child_count()); |
128 | 128 |
129 const AXNode* button_node = root_node->ChildAtIndex(0); | 129 const AXNode* button_node = root_node->ChildAtIndex(0); |
130 EXPECT_EQ(button.id, button_node->id()); | 130 EXPECT_EQ(button.id, button_node->id()); |
131 EXPECT_EQ(button.role, button_node->data().role); | 131 EXPECT_EQ(button.role, button_node->data().role); |
132 | 132 |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
321 | 321 |
322 ASSERT_EQ(1U, fake_delegate.node_creation_finished_ids().size()); | 322 ASSERT_EQ(1U, fake_delegate.node_creation_finished_ids().size()); |
323 EXPECT_EQ(4, fake_delegate.node_creation_finished_ids()[0]); | 323 EXPECT_EQ(4, fake_delegate.node_creation_finished_ids()[0]); |
324 | 324 |
325 ASSERT_EQ(true, fake_delegate.root_changed()); | 325 ASSERT_EQ(true, fake_delegate.root_changed()); |
326 | 326 |
327 tree.SetDelegate(NULL); | 327 tree.SetDelegate(NULL); |
328 } | 328 } |
329 | 329 |
330 } // namespace ui | 330 } // namespace ui |
OLD | NEW |