| 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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 return; | 43 return; |
| 44 | 44 |
| 45 tree0_.reset(new AXSerializableTree(treedata0_)); | 45 tree0_.reset(new AXSerializableTree(treedata0_)); |
| 46 tree1_.reset(new AXSerializableTree(treedata1_)); | 46 tree1_.reset(new AXSerializableTree(treedata1_)); |
| 47 | 47 |
| 48 // Serialize tree0 so that AXTreeSerializer thinks that its client | 48 // Serialize tree0 so that AXTreeSerializer thinks that its client |
| 49 // is totally in sync. | 49 // is totally in sync. |
| 50 tree0_source_.reset(tree0_->CreateTreeSource()); | 50 tree0_source_.reset(tree0_->CreateTreeSource()); |
| 51 serializer_.reset(new AXTreeSerializer<const AXNode*>(tree0_source_.get())); | 51 serializer_.reset(new AXTreeSerializer<const AXNode*>(tree0_source_.get())); |
| 52 AXTreeUpdate unused_update; | 52 AXTreeUpdate unused_update; |
| 53 serializer_->SerializeChanges(tree0_->GetRoot(), &unused_update); | 53 serializer_->SerializeChanges(tree0_->root(), &unused_update); |
| 54 | 54 |
| 55 // Pretend that tree0_ turned into tree1_. The next call to | 55 // Pretend that tree0_ turned into tree1_. The next call to |
| 56 // AXTreeSerializer will force it to consider these changes to | 56 // AXTreeSerializer will force it to consider these changes to |
| 57 // the tree and send them as part of the next update. | 57 // the tree and send them as part of the next update. |
| 58 tree1_source_.reset(tree1_->CreateTreeSource()); | 58 tree1_source_.reset(tree1_->CreateTreeSource()); |
| 59 serializer_->ChangeTreeSourceForTesting(tree1_source_.get()); | 59 serializer_->ChangeTreeSourceForTesting(tree1_source_.get()); |
| 60 } | 60 } |
| 61 | 61 |
| 62 // In this test, one child is added to the root. Only the root and | 62 // In this test, one child is added to the root. Only the root and |
| 63 // new child should be added. | 63 // new child should be added. |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 // then include nodes 2...5. | 173 // then include nodes 2...5. |
| 174 EXPECT_EQ(2, update.node_id_to_clear); | 174 EXPECT_EQ(2, update.node_id_to_clear); |
| 175 ASSERT_EQ(static_cast<size_t>(4), update.nodes.size()); | 175 ASSERT_EQ(static_cast<size_t>(4), update.nodes.size()); |
| 176 EXPECT_EQ(2, update.nodes[0].id); | 176 EXPECT_EQ(2, update.nodes[0].id); |
| 177 EXPECT_EQ(3, update.nodes[1].id); | 177 EXPECT_EQ(3, update.nodes[1].id); |
| 178 EXPECT_EQ(4, update.nodes[2].id); | 178 EXPECT_EQ(4, update.nodes[2].id); |
| 179 EXPECT_EQ(5, update.nodes[3].id); | 179 EXPECT_EQ(5, update.nodes[3].id); |
| 180 } | 180 } |
| 181 | 181 |
| 182 } // namespace ui | 182 } // namespace ui |
| OLD | NEW |