Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(159)

Side by Side Diff: ui/accessibility/ax_tree_serializer_unittest.cc

Issue 940753002: accessibility: Simpler AXTree root accessor. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix win Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ui/accessibility/ax_tree.cc ('k') | ui/accessibility/ax_tree_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « ui/accessibility/ax_tree.cc ('k') | ui/accessibility/ax_tree_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698