| 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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 IDispatch* dispatch = V_DISPATCH(var); | 42 IDispatch* dispatch = V_DISPATCH(var); |
| 43 if (dispatch) | 43 if (dispatch) |
| 44 ptr.QueryFrom(dispatch); | 44 ptr.QueryFrom(dispatch); |
| 45 break; | 45 break; |
| 46 } | 46 } |
| 47 | 47 |
| 48 case VT_I4: { | 48 case VT_I4: { |
| 49 base::win::ScopedComPtr<IDispatch> dispatch; | 49 base::win::ScopedComPtr<IDispatch> dispatch; |
| 50 HRESULT hr = parent->get_accChild(*var, dispatch.Receive()); | 50 HRESULT hr = parent->get_accChild(*var, dispatch.Receive()); |
| 51 EXPECT_TRUE(SUCCEEDED(hr)); | 51 EXPECT_TRUE(SUCCEEDED(hr)); |
| 52 if (dispatch) | 52 if (dispatch.get()) |
| 53 dispatch.QueryInterface(ptr.Receive()); | 53 dispatch.QueryInterface(ptr.Receive()); |
| 54 break; | 54 break; |
| 55 } | 55 } |
| 56 } | 56 } |
| 57 return ptr; | 57 return ptr; |
| 58 } | 58 } |
| 59 | 59 |
| 60 HRESULT QueryIAccessible2(IAccessible* accessible, IAccessible2** accessible2) { | 60 HRESULT QueryIAccessible2(IAccessible* accessible, IAccessible2** accessible2) { |
| 61 // TODO(ctguil): For some reason querying the IAccessible2 interface from | 61 // TODO(ctguil): For some reason querying the IAccessible2 interface from |
| 62 // IAccessible fails. | 62 // IAccessible fails. |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 scoped_ptr<VARIANT[]> child_array(new VARIANT[child_count]); | 102 scoped_ptr<VARIANT[]> child_array(new VARIANT[child_count]); |
| 103 LONG obtained_count = 0; | 103 LONG obtained_count = 0; |
| 104 hr = AccessibleChildren( | 104 hr = AccessibleChildren( |
| 105 node, 0, child_count, child_array.get(), &obtained_count); | 105 node, 0, child_count, child_array.get(), &obtained_count); |
| 106 ASSERT_EQ(S_OK, hr); | 106 ASSERT_EQ(S_OK, hr); |
| 107 ASSERT_EQ(child_count, obtained_count); | 107 ASSERT_EQ(child_count, obtained_count); |
| 108 | 108 |
| 109 for (int index = 0; index < obtained_count; index++) { | 109 for (int index = 0; index < obtained_count; index++) { |
| 110 base::win::ScopedComPtr<IAccessible> child_accessible( | 110 base::win::ScopedComPtr<IAccessible> child_accessible( |
| 111 GetAccessibleFromResultVariant(node, &child_array.get()[index])); | 111 GetAccessibleFromResultVariant(node, &child_array.get()[index])); |
| 112 if (child_accessible) { | 112 if (child_accessible.get()) { |
| 113 RecursiveFindNodeInAccessibilityTree( | 113 RecursiveFindNodeInAccessibilityTree( |
| 114 child_accessible.get(), expected_role, expected_name, depth + 1, | 114 child_accessible.get(), expected_role, expected_name, depth + 1, |
| 115 found); | 115 found); |
| 116 if (*found) | 116 if (*found) |
| 117 return; | 117 return; |
| 118 } | 118 } |
| 119 } | 119 } |
| 120 } | 120 } |
| 121 | 121 |
| 122 | 122 |
| (...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 373 ASSERT_EQ(S_OK, hr); | 373 ASSERT_EQ(S_OK, hr); |
| 374 ASSERT_EQ(child_count, obtained_count); | 374 ASSERT_EQ(child_count, obtained_count); |
| 375 | 375 |
| 376 VARIANT* child = child_array.get(); | 376 VARIANT* child = child_array.get(); |
| 377 for (AccessibleCheckerVector::iterator child_checker = children_.begin(); | 377 for (AccessibleCheckerVector::iterator child_checker = children_.begin(); |
| 378 child_checker != children_.end(); | 378 child_checker != children_.end(); |
| 379 ++child_checker, ++child) { | 379 ++child_checker, ++child) { |
| 380 base::win::ScopedComPtr<IAccessible> child_accessible( | 380 base::win::ScopedComPtr<IAccessible> child_accessible( |
| 381 GetAccessibleFromResultVariant(parent, child)); | 381 GetAccessibleFromResultVariant(parent, child)); |
| 382 ASSERT_TRUE(child_accessible.get()); | 382 ASSERT_TRUE(child_accessible.get()); |
| 383 (*child_checker)->CheckAccessible(child_accessible); | 383 (*child_checker)->CheckAccessible(child_accessible.get()); |
| 384 } | 384 } |
| 385 } | 385 } |
| 386 | 386 |
| 387 base::string16 AccessibleChecker::RoleVariantToString( | 387 base::string16 AccessibleChecker::RoleVariantToString( |
| 388 const base::win::ScopedVariant& role) { | 388 const base::win::ScopedVariant& role) { |
| 389 if (role.type() == VT_I4) | 389 if (role.type() == VT_I4) |
| 390 return IAccessibleRoleToString(V_I4(&role)); | 390 return IAccessibleRoleToString(V_I4(&role)); |
| 391 if (role.type() == VT_BSTR) | 391 if (role.type() == VT_BSTR) |
| 392 return base::string16(V_BSTR(&role), SysStringLen(V_BSTR(&role))); | 392 return base::string16(V_BSTR(&role), SysStringLen(V_BSTR(&role))); |
| 393 return base::string16(); | 393 return base::string16(); |
| (...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 677 LoadInitialAccessibilityTreeFromHtml( | 677 LoadInitialAccessibilityTreeFromHtml( |
| 678 "<body><input type='checkbox' /></body>"); | 678 "<body><input type='checkbox' /></body>"); |
| 679 | 679 |
| 680 // Get the IAccessible object for the document. | 680 // Get the IAccessible object for the document. |
| 681 base::win::ScopedComPtr<IAccessible> document_accessible( | 681 base::win::ScopedComPtr<IAccessible> document_accessible( |
| 682 GetRendererAccessible()); | 682 GetRendererAccessible()); |
| 683 ASSERT_NE(document_accessible.get(), reinterpret_cast<IAccessible*>(NULL)); | 683 ASSERT_NE(document_accessible.get(), reinterpret_cast<IAccessible*>(NULL)); |
| 684 | 684 |
| 685 // Get the ISimpleDOM object for the document. | 685 // Get the ISimpleDOM object for the document. |
| 686 base::win::ScopedComPtr<IServiceProvider> service_provider; | 686 base::win::ScopedComPtr<IServiceProvider> service_provider; |
| 687 HRESULT hr = static_cast<IAccessible*>(document_accessible)->QueryInterface( | 687 HRESULT hr = static_cast<IAccessible*>(document_accessible.get()) |
| 688 service_provider.Receive()); | 688 ->QueryInterface(service_provider.Receive()); |
| 689 ASSERT_EQ(S_OK, hr); | 689 ASSERT_EQ(S_OK, hr); |
| 690 const GUID refguid = {0x0c539790, 0x12e4, 0x11cf, | 690 const GUID refguid = {0x0c539790, 0x12e4, 0x11cf, |
| 691 0xb6, 0x61, 0x00, 0xaa, 0x00, 0x4c, 0xd6, 0xd8}; | 691 0xb6, 0x61, 0x00, 0xaa, 0x00, 0x4c, 0xd6, 0xd8}; |
| 692 base::win::ScopedComPtr<ISimpleDOMNode> document_isimpledomnode; | 692 base::win::ScopedComPtr<ISimpleDOMNode> document_isimpledomnode; |
| 693 hr = static_cast<IServiceProvider *>(service_provider)->QueryService( | 693 hr = static_cast<IServiceProvider*>(service_provider.get()) |
| 694 refguid, IID_ISimpleDOMNode, | 694 ->QueryService( |
| 695 reinterpret_cast<void**>(document_isimpledomnode.Receive())); | 695 refguid, IID_ISimpleDOMNode, |
| 696 reinterpret_cast<void**>(document_isimpledomnode.Receive())); |
| 696 ASSERT_EQ(S_OK, hr); | 697 ASSERT_EQ(S_OK, hr); |
| 697 | 698 |
| 698 base::win::ScopedBstr node_name; | 699 base::win::ScopedBstr node_name; |
| 699 short name_space_id; // NOLINT | 700 short name_space_id; // NOLINT |
| 700 base::win::ScopedBstr node_value; | 701 base::win::ScopedBstr node_value; |
| 701 unsigned int num_children; | 702 unsigned int num_children; |
| 702 unsigned int unique_id; | 703 unsigned int unique_id; |
| 703 unsigned short node_type; // NOLINT | 704 unsigned short node_type; // NOLINT |
| 704 hr = document_isimpledomnode->get_nodeInfo( | 705 hr = document_isimpledomnode->get_nodeInfo( |
| 705 node_name.Receive(), &name_space_id, node_value.Receive(), &num_children, | 706 node_name.Receive(), &name_space_id, node_value.Receive(), &num_children, |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 747 AccessibleChecker grouping2_checker(std::wstring(), ROLE_SYSTEM_GROUPING, | 748 AccessibleChecker grouping2_checker(std::wstring(), ROLE_SYSTEM_GROUPING, |
| 748 std::wstring()); | 749 std::wstring()); |
| 749 AccessibleChecker document_checker(std::wstring(), ROLE_SYSTEM_DOCUMENT, | 750 AccessibleChecker document_checker(std::wstring(), ROLE_SYSTEM_DOCUMENT, |
| 750 std::wstring()); | 751 std::wstring()); |
| 751 document_checker.AppendExpectedChild(&grouping1_checker); | 752 document_checker.AppendExpectedChild(&grouping1_checker); |
| 752 document_checker.AppendExpectedChild(&grouping2_checker); | 753 document_checker.AppendExpectedChild(&grouping2_checker); |
| 753 document_checker.CheckAccessible(GetRendererAccessible()); | 754 document_checker.CheckAccessible(GetRendererAccessible()); |
| 754 } | 755 } |
| 755 | 756 |
| 756 } // namespace content | 757 } // namespace content |
| OLD | NEW |