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 14 matching lines...) Expand all Loading... |
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 OnRootChanged(AXNode* new_root) OVERRIDE { | 31 virtual void OnRootChanged(AXNode* new_root) OVERRIDE { |
32 new_root_ids_.push_back(new_root->id()); | 32 new_root_ids_.push_back(new_root->id()); |
33 } | 33 } |
34 | 34 |
35 void Reset() { | |
36 deleted_ids_.clear(); | |
37 created_ids_.clear(); | |
38 changed_ids_.clear(); | |
39 new_root_ids_.clear(); | |
40 } | |
41 | |
42 const std::vector<int32>& deleted_ids() { return deleted_ids_; } | 35 const std::vector<int32>& deleted_ids() { return deleted_ids_; } |
43 const std::vector<int32>& created_ids() { return created_ids_; } | 36 const std::vector<int32>& created_ids() { return created_ids_; } |
44 const std::vector<int32>& changed_ids() { return changed_ids_; } | |
45 const std::vector<int32>& new_root_ids() { return new_root_ids_; } | 37 const std::vector<int32>& new_root_ids() { return new_root_ids_; } |
46 | 38 |
47 private: | 39 private: |
48 std::vector<int32> deleted_ids_; | 40 std::vector<int32> deleted_ids_; |
49 std::vector<int32> created_ids_; | 41 std::vector<int32> created_ids_; |
50 std::vector<int32> changed_ids_; | 42 std::vector<int32> changed_ids_; |
51 std::vector<int32> new_root_ids_; | 43 std::vector<int32> new_root_ids_; |
52 }; | 44 }; |
53 | 45 |
54 } // namespace | 46 } // namespace |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
242 EXPECT_EQ(2, fake_delegate.created_ids()[0]); | 234 EXPECT_EQ(2, fake_delegate.created_ids()[0]); |
243 EXPECT_EQ(3, fake_delegate.created_ids()[1]); | 235 EXPECT_EQ(3, fake_delegate.created_ids()[1]); |
244 | 236 |
245 ASSERT_EQ(1U, fake_delegate.new_root_ids().size()); | 237 ASSERT_EQ(1U, fake_delegate.new_root_ids().size()); |
246 EXPECT_EQ(2, fake_delegate.new_root_ids()[0]); | 238 EXPECT_EQ(2, fake_delegate.new_root_ids()[0]); |
247 | 239 |
248 tree.SetDelegate(NULL); | 240 tree.SetDelegate(NULL); |
249 } | 241 } |
250 | 242 |
251 } // namespace ui | 243 } // namespace ui |
OLD | NEW |