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 <atlbase.h> | 5 #include <atlbase.h> |
6 #include <atlcom.h> | 6 #include <atlcom.h> |
7 #include <oleacc.h> | 7 #include <oleacc.h> |
8 | 8 |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/win/scoped_bstr.h" | 10 #include "base/win/scoped_bstr.h" |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 ScopedBstr description; | 147 ScopedBstr description; |
148 ASSERT_EQ(S_OK, root_obj->get_accDescription(SELF, description.Receive())); | 148 ASSERT_EQ(S_OK, root_obj->get_accDescription(SELF, description.Receive())); |
149 EXPECT_EQ(L"Description", base::string16(description)); | 149 EXPECT_EQ(L"Description", base::string16(description)); |
150 | 150 |
151 ASSERT_EQ(E_INVALIDARG, root_obj->get_accDescription(SELF, nullptr)); | 151 ASSERT_EQ(E_INVALIDARG, root_obj->get_accDescription(SELF, nullptr)); |
152 ScopedVariant bad_id(999); | 152 ScopedVariant bad_id(999); |
153 ScopedBstr d2; | 153 ScopedBstr d2; |
154 ASSERT_EQ(E_INVALIDARG, root_obj->get_accDescription(bad_id, d2.Receive())); | 154 ASSERT_EQ(E_INVALIDARG, root_obj->get_accDescription(bad_id, d2.Receive())); |
155 } | 155 } |
156 | 156 |
157 TEST_F(AXPlatformNodeWinTest, TestIAccessibleHelp) { | |
158 AXNodeData root; | |
159 root.id = 1; | |
160 root.role = AX_ROLE_ROOT_WEB_AREA; | |
161 root.AddStringAttribute(AX_ATTR_HELP, "Help"); | |
162 Init(root); | |
163 | |
164 ScopedComPtr<IAccessible> root_obj(GetRootIAccessible()); | |
165 ScopedBstr help; | |
166 ASSERT_EQ(S_OK, root_obj->get_accHelp(SELF, help.Receive())); | |
167 EXPECT_EQ(L"Help", base::string16(help)); | |
168 | |
169 ASSERT_EQ(E_INVALIDARG, root_obj->get_accHelp(SELF, nullptr)); | |
170 ScopedVariant bad_id(999); | |
171 ScopedBstr h2; | |
172 ASSERT_EQ(E_INVALIDARG, root_obj->get_accHelp(bad_id, h2.Receive())); | |
173 } | |
174 | |
175 TEST_F(AXPlatformNodeWinTest, TestIAccessibleValue) { | 157 TEST_F(AXPlatformNodeWinTest, TestIAccessibleValue) { |
176 AXNodeData root; | 158 AXNodeData root; |
177 root.id = 1; | 159 root.id = 1; |
178 root.role = AX_ROLE_ROOT_WEB_AREA; | 160 root.role = AX_ROLE_ROOT_WEB_AREA; |
179 root.AddStringAttribute(AX_ATTR_VALUE, "Value"); | 161 root.AddStringAttribute(AX_ATTR_VALUE, "Value"); |
180 Init(root); | 162 Init(root); |
181 | 163 |
182 ScopedComPtr<IAccessible> root_obj(GetRootIAccessible()); | 164 ScopedComPtr<IAccessible> root_obj(GetRootIAccessible()); |
183 ScopedBstr value; | 165 ScopedBstr value; |
184 ASSERT_EQ(S_OK, root_obj->get_accValue(SELF, value.Receive())); | 166 ASSERT_EQ(S_OK, root_obj->get_accValue(SELF, value.Receive())); |
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
399 ASSERT_EQ(E_FAIL, root_iaccessible2->get_indexInParent(&index)); | 381 ASSERT_EQ(E_FAIL, root_iaccessible2->get_indexInParent(&index)); |
400 | 382 |
401 ASSERT_EQ(S_OK, left_iaccessible2->get_indexInParent(&index)); | 383 ASSERT_EQ(S_OK, left_iaccessible2->get_indexInParent(&index)); |
402 EXPECT_EQ(0, index); | 384 EXPECT_EQ(0, index); |
403 | 385 |
404 ASSERT_EQ(S_OK, right_iaccessible2->get_indexInParent(&index)); | 386 ASSERT_EQ(S_OK, right_iaccessible2->get_indexInParent(&index)); |
405 EXPECT_EQ(1, index); | 387 EXPECT_EQ(1, index); |
406 } | 388 } |
407 | 389 |
408 } // namespace ui | 390 } // namespace ui |
OLD | NEW |