OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "ui/accessibility/platform/ax_platform_node.h" |
| 6 |
5 #include <atlbase.h> | 7 #include <atlbase.h> |
6 #include <atlcom.h> | 8 #include <atlcom.h> |
7 #include <oleacc.h> | 9 #include <oleacc.h> |
8 | 10 |
9 #include "base/memory/scoped_ptr.h" | 11 #include <memory> |
| 12 |
10 #include "base/win/scoped_bstr.h" | 13 #include "base/win/scoped_bstr.h" |
11 #include "base/win/scoped_comptr.h" | 14 #include "base/win/scoped_comptr.h" |
12 #include "base/win/scoped_variant.h" | 15 #include "base/win/scoped_variant.h" |
13 #include "testing/gtest/include/gtest/gtest.h" | 16 #include "testing/gtest/include/gtest/gtest.h" |
14 #include "third_party/iaccessible2/ia2_api_all.h" | 17 #include "third_party/iaccessible2/ia2_api_all.h" |
15 #include "ui/accessibility/ax_node_data.h" | 18 #include "ui/accessibility/ax_node_data.h" |
16 #include "ui/accessibility/platform/ax_platform_node.h" | |
17 #include "ui/accessibility/platform/test_ax_node_wrapper.h" | 19 #include "ui/accessibility/platform/test_ax_node_wrapper.h" |
18 #include "ui/base/win/atl_module.h" | 20 #include "ui/base/win/atl_module.h" |
19 | 21 |
20 using base::win::ScopedBstr; | 22 using base::win::ScopedBstr; |
21 using base::win::ScopedComPtr; | 23 using base::win::ScopedComPtr; |
22 using base::win::ScopedVariant; | 24 using base::win::ScopedVariant; |
23 | 25 |
24 namespace ui { | 26 namespace ui { |
25 | 27 |
26 namespace { | 28 namespace { |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 ScopedComPtr<IAccessible2> ToIAccessible2( | 93 ScopedComPtr<IAccessible2> ToIAccessible2( |
92 ScopedComPtr<IAccessible> accessible) { | 94 ScopedComPtr<IAccessible> accessible) { |
93 ScopedComPtr<IServiceProvider> service_provider; | 95 ScopedComPtr<IServiceProvider> service_provider; |
94 service_provider.QueryFrom(accessible.get()); | 96 service_provider.QueryFrom(accessible.get()); |
95 ScopedComPtr<IAccessible2> result; | 97 ScopedComPtr<IAccessible2> result; |
96 CHECK(SUCCEEDED( | 98 CHECK(SUCCEEDED( |
97 service_provider->QueryService(IID_IAccessible2, result.Receive()))); | 99 service_provider->QueryService(IID_IAccessible2, result.Receive()))); |
98 return result; | 100 return result; |
99 } | 101 } |
100 | 102 |
101 scoped_ptr<AXTree> tree_; | 103 std::unique_ptr<AXTree> tree_; |
102 }; | 104 }; |
103 | 105 |
104 TEST_F(AXPlatformNodeWinTest, TestIAccessibleDetachedObject) { | 106 TEST_F(AXPlatformNodeWinTest, TestIAccessibleDetachedObject) { |
105 AXNodeData root; | 107 AXNodeData root; |
106 root.id = 1; | 108 root.id = 1; |
107 root.role = AX_ROLE_ROOT_WEB_AREA; | 109 root.role = AX_ROLE_ROOT_WEB_AREA; |
108 root.AddStringAttribute(AX_ATTR_NAME, "Name"); | 110 root.AddStringAttribute(AX_ATTR_NAME, "Name"); |
109 Init(root); | 111 Init(root); |
110 | 112 |
111 ScopedComPtr<IAccessible> root_obj(GetRootIAccessible()); | 113 ScopedComPtr<IAccessible> root_obj(GetRootIAccessible()); |
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
396 ASSERT_EQ(E_FAIL, root_iaccessible2->get_indexInParent(&index)); | 398 ASSERT_EQ(E_FAIL, root_iaccessible2->get_indexInParent(&index)); |
397 | 399 |
398 ASSERT_EQ(S_OK, left_iaccessible2->get_indexInParent(&index)); | 400 ASSERT_EQ(S_OK, left_iaccessible2->get_indexInParent(&index)); |
399 EXPECT_EQ(0, index); | 401 EXPECT_EQ(0, index); |
400 | 402 |
401 ASSERT_EQ(S_OK, right_iaccessible2->get_indexInParent(&index)); | 403 ASSERT_EQ(S_OK, right_iaccessible2->get_indexInParent(&index)); |
402 EXPECT_EQ(1, index); | 404 EXPECT_EQ(1, index); |
403 } | 405 } |
404 | 406 |
405 } // namespace ui | 407 } // namespace ui |
OLD | NEW |