OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <vector> | 5 #include <vector> |
6 | 6 |
7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
9 #include "base/win/scoped_bstr.h" | 9 #include "base/win/scoped_bstr.h" |
10 #include "base/win/scoped_comptr.h" | 10 #include "base/win/scoped_comptr.h" |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 node->get_accName(childid_self, name_bstr.Receive()); | 84 node->get_accName(childid_self, name_bstr.Receive()); |
85 std::wstring name(name_bstr, name_bstr.Length()); | 85 std::wstring name(name_bstr, name_bstr.Length()); |
86 base::win::ScopedVariant role; | 86 base::win::ScopedVariant role; |
87 node->get_accRole(childid_self, role.Receive()); | 87 node->get_accRole(childid_self, role.Receive()); |
88 ASSERT_EQ(VT_I4, role.type()); | 88 ASSERT_EQ(VT_I4, role.type()); |
89 | 89 |
90 // Print the accessibility tree as we go, because if this test fails | 90 // Print the accessibility tree as we go, because if this test fails |
91 // on the bots, this is really helpful in figuring out why. | 91 // on the bots, this is really helpful in figuring out why. |
92 for (int i = 0; i < depth; i++) | 92 for (int i = 0; i < depth; i++) |
93 printf(" "); | 93 printf(" "); |
94 printf("role=%d name=%s\n", V_I4(&role), WideToUTF8(name).c_str()); | 94 printf("role=%d name=%s\n", V_I4(&role), base::WideToUTF8(name).c_str()); |
95 | 95 |
96 if (expected_role == V_I4(&role) && expected_name == name) { | 96 if (expected_role == V_I4(&role) && expected_name == name) { |
97 *found = true; | 97 *found = true; |
98 return; | 98 return; |
99 } | 99 } |
100 | 100 |
101 LONG child_count = 0; | 101 LONG child_count = 0; |
102 HRESULT hr = node->get_accChildCount(&child_count); | 102 HRESULT hr = node->get_accChildCount(&child_count); |
103 ASSERT_EQ(S_OK, hr); | 103 ASSERT_EQ(S_OK, hr); |
104 | 104 |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
279 value_(expected_value), | 279 value_(expected_value), |
280 state_(-1) { | 280 state_(-1) { |
281 } | 281 } |
282 | 282 |
283 void AccessibleChecker::AppendExpectedChild( | 283 void AccessibleChecker::AppendExpectedChild( |
284 AccessibleChecker* expected_child) { | 284 AccessibleChecker* expected_child) { |
285 children_.push_back(expected_child); | 285 children_.push_back(expected_child); |
286 } | 286 } |
287 | 287 |
288 void AccessibleChecker::CheckAccessible(IAccessible* accessible) { | 288 void AccessibleChecker::CheckAccessible(IAccessible* accessible) { |
289 SCOPED_TRACE("while checking " + UTF16ToUTF8(RoleVariantToString(role_))); | 289 SCOPED_TRACE("while checking " + |
| 290 base::UTF16ToUTF8(RoleVariantToString(role_))); |
290 CheckAccessibleName(accessible); | 291 CheckAccessibleName(accessible); |
291 CheckAccessibleRole(accessible); | 292 CheckAccessibleRole(accessible); |
292 CheckIA2Role(accessible); | 293 CheckIA2Role(accessible); |
293 CheckAccessibleValue(accessible); | 294 CheckAccessibleValue(accessible); |
294 CheckAccessibleState(accessible); | 295 CheckAccessibleState(accessible); |
295 CheckAccessibleChildren(accessible); | 296 CheckAccessibleChildren(accessible); |
296 } | 297 } |
297 | 298 |
298 void AccessibleChecker::SetExpectedValue(const std::wstring& expected_value) { | 299 void AccessibleChecker::SetExpectedValue(const std::wstring& expected_value) { |
299 value_ = expected_value; | 300 value_ = expected_value; |
(...skipping 574 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
874 AccessibleChecker grouping2_checker(std::wstring(), ROLE_SYSTEM_GROUPING, | 875 AccessibleChecker grouping2_checker(std::wstring(), ROLE_SYSTEM_GROUPING, |
875 std::wstring()); | 876 std::wstring()); |
876 AccessibleChecker document_checker(std::wstring(), ROLE_SYSTEM_DOCUMENT, | 877 AccessibleChecker document_checker(std::wstring(), ROLE_SYSTEM_DOCUMENT, |
877 std::wstring()); | 878 std::wstring()); |
878 document_checker.AppendExpectedChild(&grouping1_checker); | 879 document_checker.AppendExpectedChild(&grouping1_checker); |
879 document_checker.AppendExpectedChild(&grouping2_checker); | 880 document_checker.AppendExpectedChild(&grouping2_checker); |
880 document_checker.CheckAccessible(GetRendererAccessible()); | 881 document_checker.CheckAccessible(GetRendererAccessible()); |
881 } | 882 } |
882 | 883 |
883 } // namespace content | 884 } // namespace content |
OLD | NEW |