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

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

Issue 1550483002: Switch to standard integer types in ui/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@int-ui-events
Patch Set: Created 4 years, 12 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_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 <stddef.h>
6 #include <stdint.h>
7
8 #include "base/macros.h"
5 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
6 #include "base/strings/string_number_conversions.h" 10 #include "base/strings/string_number_conversions.h"
7 #include "testing/gtest/include/gtest/gtest.h" 11 #include "testing/gtest/include/gtest/gtest.h"
8 #include "ui/accessibility/ax_node.h" 12 #include "ui/accessibility/ax_node.h"
9 #include "ui/accessibility/ax_serializable_tree.h" 13 #include "ui/accessibility/ax_serializable_tree.h"
10 #include "ui/accessibility/ax_tree.h" 14 #include "ui/accessibility/ax_tree.h"
11 #include "ui/accessibility/ax_tree_serializer.h" 15 #include "ui/accessibility/ax_tree_serializer.h"
12 16
13 namespace ui { 17 namespace ui {
14 18
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 : public AXTreeSource<const AXNode*, AXNodeData, AXTreeData> { 194 : public AXTreeSource<const AXNode*, AXNodeData, AXTreeData> {
191 public: 195 public:
192 AXTreeSourceWithInvalidId(AXTree* tree, int invalid_id) 196 AXTreeSourceWithInvalidId(AXTree* tree, int invalid_id)
193 : tree_(tree), 197 : tree_(tree),
194 invalid_id_(invalid_id) {} 198 invalid_id_(invalid_id) {}
195 ~AXTreeSourceWithInvalidId() override {} 199 ~AXTreeSourceWithInvalidId() override {}
196 200
197 // AXTreeSource implementation. 201 // AXTreeSource implementation.
198 AXTreeData GetTreeData() const override { return AXTreeData(); } 202 AXTreeData GetTreeData() const override { return AXTreeData(); }
199 AXNode* GetRoot() const override { return tree_->root(); } 203 AXNode* GetRoot() const override { return tree_->root(); }
200 AXNode* GetFromId(int32 id) const override { return tree_->GetFromId(id); } 204 AXNode* GetFromId(int32_t id) const override { return tree_->GetFromId(id); }
201 int32 GetId(const AXNode* node) const override { return node->id(); } 205 int32_t GetId(const AXNode* node) const override { return node->id(); }
202 void GetChildren(const AXNode* node, 206 void GetChildren(const AXNode* node,
203 std::vector<const AXNode*>* out_children) const override { 207 std::vector<const AXNode*>* out_children) const override {
204 for (int i = 0; i < node->child_count(); ++i) 208 for (int i = 0; i < node->child_count(); ++i)
205 out_children->push_back(node->ChildAtIndex(i)); 209 out_children->push_back(node->ChildAtIndex(i));
206 } 210 }
207 AXNode* GetParent(const AXNode* node) const override { 211 AXNode* GetParent(const AXNode* node) const override {
208 return node->parent(); 212 return node->parent();
209 } 213 }
210 bool IsValid(const AXNode* node) const override { 214 bool IsValid(const AXNode* node) const override {
211 return node != NULL && node->id() != invalid_id_; 215 return node != NULL && node->id() != invalid_id_;
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 serializer_.reset(new BasicAXTreeSerializer(tree0_source_.get())); 279 serializer_.reset(new BasicAXTreeSerializer(tree0_source_.get()));
276 serializer_->set_max_node_count(4); 280 serializer_->set_max_node_count(4);
277 AXTreeUpdate update; 281 AXTreeUpdate update;
278 serializer_->SerializeChanges(tree0_->root(), &update); 282 serializer_->SerializeChanges(tree0_->root(), &update);
279 // It actually serializes 5 nodes, not 4 - to be consistent. 283 // It actually serializes 5 nodes, not 4 - to be consistent.
280 // It skips the children of node 5. 284 // It skips the children of node 5.
281 ASSERT_EQ(static_cast<size_t>(5), update.nodes.size()); 285 ASSERT_EQ(static_cast<size_t>(5), update.nodes.size());
282 } 286 }
283 287
284 } // namespace ui 288 } // 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