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

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

Issue 125783002: Add AXTreeDelegate and refactor other AXTree classes slightly. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed const issue Created 6 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « ui/accessibility/ax_tree_serializer.h ('k') | ui/accessibility/ax_tree_source.h » ('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 12 matching lines...) Expand all
23 AXTreeSerializerTest() {} 23 AXTreeSerializerTest() {}
24 virtual ~AXTreeSerializerTest() {} 24 virtual ~AXTreeSerializerTest() {}
25 25
26 protected: 26 protected:
27 void CreateTreeSerializer(); 27 void CreateTreeSerializer();
28 28
29 AXTreeUpdate treedata0_; 29 AXTreeUpdate treedata0_;
30 AXTreeUpdate treedata1_; 30 AXTreeUpdate treedata1_;
31 scoped_ptr<AXSerializableTree> tree0_; 31 scoped_ptr<AXSerializableTree> tree0_;
32 scoped_ptr<AXSerializableTree> tree1_; 32 scoped_ptr<AXSerializableTree> tree1_;
33 scoped_ptr<AXTreeSource<AXNode> > tree0_source_; 33 scoped_ptr<AXTreeSource<const AXNode*> > tree0_source_;
34 scoped_ptr<AXTreeSource<AXNode> > tree1_source_; 34 scoped_ptr<AXTreeSource<const AXNode*> > tree1_source_;
35 scoped_ptr<AXTreeSerializer<AXNode> > serializer_; 35 scoped_ptr<AXTreeSerializer<const AXNode*> > serializer_;
36 36
37 private: 37 private:
38 DISALLOW_COPY_AND_ASSIGN(AXTreeSerializerTest); 38 DISALLOW_COPY_AND_ASSIGN(AXTreeSerializerTest);
39 }; 39 };
40 40
41 void AXTreeSerializerTest::CreateTreeSerializer() { 41 void AXTreeSerializerTest::CreateTreeSerializer() {
42 if (serializer_) 42 if (serializer_)
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<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_->GetRoot(), &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
(...skipping 111 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_serializer.h ('k') | ui/accessibility/ax_tree_source.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698