| 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" |
| 11 #include "ui/accessibility/ax_tree_serializer.h" | 11 #include "ui/accessibility/ax_tree_serializer.h" |
| 12 | 12 |
| 13 namespace ui { | 13 namespace ui { |
| 14 | 14 |
| 15 namespace { | 15 namespace { |
| 16 | 16 |
| 17 class FakeAXTreeDelegate : public AXTreeDelegate { | 17 class FakeAXTreeDelegate : public AXTreeDelegate { |
| 18 public: | 18 public: |
| 19 virtual void OnNodeWillBeDeleted(AXNode* node) OVERRIDE { | 19 virtual void OnNodeWillBeDeleted(AXNode* node) override { |
| 20 deleted_ids_.push_back(node->id()); | 20 deleted_ids_.push_back(node->id()); |
| 21 } | 21 } |
| 22 | 22 |
| 23 virtual void OnNodeCreated(AXNode* node) OVERRIDE { | 23 virtual void OnNodeCreated(AXNode* node) override { |
| 24 created_ids_.push_back(node->id()); | 24 created_ids_.push_back(node->id()); |
| 25 } | 25 } |
| 26 | 26 |
| 27 virtual void OnNodeChanged(AXNode* node) OVERRIDE { | 27 virtual void OnNodeChanged(AXNode* node) override { |
| 28 changed_ids_.push_back(node->id()); | 28 changed_ids_.push_back(node->id()); |
| 29 } | 29 } |
| 30 | 30 |
| 31 virtual void OnNodeCreationFinished(AXNode* node) OVERRIDE { | 31 virtual void OnNodeCreationFinished(AXNode* node) override { |
| 32 creation_finished_ids_.push_back(node->id()); | 32 creation_finished_ids_.push_back(node->id()); |
| 33 } | 33 } |
| 34 | 34 |
| 35 virtual void OnNodeChangeFinished(AXNode* node) OVERRIDE { | 35 virtual void OnNodeChangeFinished(AXNode* node) override { |
| 36 change_finished_ids_.push_back(node->id()); | 36 change_finished_ids_.push_back(node->id()); |
| 37 } | 37 } |
| 38 | 38 |
| 39 virtual void OnRootChanged(AXNode* new_root) OVERRIDE { | 39 virtual void OnRootChanged(AXNode* new_root) override { |
| 40 new_root_ids_.push_back(new_root->id()); | 40 new_root_ids_.push_back(new_root->id()); |
| 41 } | 41 } |
| 42 | 42 |
| 43 const std::vector<int32>& deleted_ids() { return deleted_ids_; } | 43 const std::vector<int32>& deleted_ids() { return deleted_ids_; } |
| 44 const std::vector<int32>& created_ids() { return created_ids_; } | 44 const std::vector<int32>& created_ids() { return created_ids_; } |
| 45 const std::vector<int32>& creation_finished_ids() { | 45 const std::vector<int32>& creation_finished_ids() { |
| 46 return creation_finished_ids_; | 46 return creation_finished_ids_; |
| 47 } | 47 } |
| 48 const std::vector<int32>& new_root_ids() { return new_root_ids_; } | 48 const std::vector<int32>& new_root_ids() { return new_root_ids_; } |
| 49 | 49 |
| (...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 289 EXPECT_EQ(2, fake_delegate.creation_finished_ids()[0]); | 289 EXPECT_EQ(2, fake_delegate.creation_finished_ids()[0]); |
| 290 EXPECT_EQ(3, fake_delegate.creation_finished_ids()[1]); | 290 EXPECT_EQ(3, fake_delegate.creation_finished_ids()[1]); |
| 291 | 291 |
| 292 ASSERT_EQ(1U, fake_delegate.new_root_ids().size()); | 292 ASSERT_EQ(1U, fake_delegate.new_root_ids().size()); |
| 293 EXPECT_EQ(2, fake_delegate.new_root_ids()[0]); | 293 EXPECT_EQ(2, fake_delegate.new_root_ids()[0]); |
| 294 | 294 |
| 295 tree.SetDelegate(NULL); | 295 tree.SetDelegate(NULL); |
| 296 } | 296 } |
| 297 | 297 |
| 298 } // namespace ui | 298 } // namespace ui |
| OLD | NEW |