Chromium Code Reviews| 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" | 5 #include "ui/accessibility/platform/ax_platform_node.h" |
| 6 | 6 |
| 7 #include <atlbase.h> | 7 #include <atlbase.h> |
| 8 #include <atlcom.h> | 8 #include <atlcom.h> |
| 9 #include <oleacc.h> | 9 #include <oleacc.h> |
| 10 | 10 |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 117 ScopedComPtr<IAccessible> root_obj(GetRootIAccessible()); | 117 ScopedComPtr<IAccessible> root_obj(GetRootIAccessible()); |
| 118 ScopedBstr name; | 118 ScopedBstr name; |
| 119 EXPECT_EQ(S_OK, root_obj->get_accName(SELF, name.Receive())); | 119 EXPECT_EQ(S_OK, root_obj->get_accName(SELF, name.Receive())); |
| 120 EXPECT_STREQ(L"Name", name); | 120 EXPECT_STREQ(L"Name", name); |
| 121 | 121 |
| 122 tree_.reset(new AXTree()); | 122 tree_.reset(new AXTree()); |
| 123 ScopedBstr name2; | 123 ScopedBstr name2; |
| 124 EXPECT_EQ(E_FAIL, root_obj->get_accName(SELF, name2.Receive())); | 124 EXPECT_EQ(E_FAIL, root_obj->get_accName(SELF, name2.Receive())); |
| 125 } | 125 } |
| 126 | 126 |
| 127 TEST_F(AXPlatformNodeWinTest, TestIAccessibleHitTest) { | |
| 128 AXNodeData root; | |
| 129 root.id = 1; | |
| 130 root.location = gfx::RectF(10, 40, 800, 600); | |
|
dmazzoni
2017/06/23 18:51:12
Can you make this unit test work with more than on
dougt
2017/06/25 21:16:32
Done.
| |
| 131 root.AddStringAttribute(AX_ATTR_NAME, "Name"); | |
| 132 Init(root); | |
| 133 | |
| 134 ScopedComPtr<IAccessible> root_obj(GetRootIAccessible()); | |
| 135 | |
| 136 ScopedVariant obj; | |
| 137 EXPECT_EQ(S_FALSE, root_obj->accHitTest(0, 0, obj.Receive())); | |
| 138 EXPECT_EQ(VT_EMPTY, obj.type()); | |
| 139 | |
| 140 EXPECT_EQ(S_OK, root_obj->accHitTest(11, 41, obj.Receive())); | |
| 141 // This is expected to return a id, not a dispatch. | |
|
dmazzoni
2017/06/23 18:51:12
Shouldn't it return a dispatch if it's anything ot
dougt
2017/06/25 21:16:32
Done.
This was because our hit test testing code
| |
| 142 EXPECT_EQ(VT_I4, obj.type()); | |
| 143 } | |
| 144 | |
| 127 TEST_F(AXPlatformNodeWinTest, TestIAccessibleName) { | 145 TEST_F(AXPlatformNodeWinTest, TestIAccessibleName) { |
| 128 AXNodeData root; | 146 AXNodeData root; |
| 129 root.id = 1; | 147 root.id = 1; |
| 130 root.AddStringAttribute(AX_ATTR_NAME, "Name"); | 148 root.AddStringAttribute(AX_ATTR_NAME, "Name"); |
| 131 Init(root); | 149 Init(root); |
| 132 | 150 |
| 133 ScopedComPtr<IAccessible> root_obj(GetRootIAccessible()); | 151 ScopedComPtr<IAccessible> root_obj(GetRootIAccessible()); |
| 134 ScopedBstr name; | 152 ScopedBstr name; |
| 135 EXPECT_EQ(S_OK, root_obj->get_accName(SELF, name.Receive())); | 153 EXPECT_EQ(S_OK, root_obj->get_accName(SELF, name.Receive())); |
| 136 EXPECT_STREQ(L"Name", name); | 154 EXPECT_STREQ(L"Name", name); |
| (...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 513 EXPECT_HRESULT_SUCCEEDED(text_field->setSelection(0, 1, 0)); | 531 EXPECT_HRESULT_SUCCEEDED(text_field->setSelection(0, 1, 0)); |
| 514 EXPECT_HRESULT_SUCCEEDED(text_field->setSelection(0, 2, 2)); | 532 EXPECT_HRESULT_SUCCEEDED(text_field->setSelection(0, 2, 2)); |
| 515 EXPECT_HRESULT_SUCCEEDED(text_field->setSelection(0, IA2_TEXT_OFFSET_CARET, | 533 EXPECT_HRESULT_SUCCEEDED(text_field->setSelection(0, IA2_TEXT_OFFSET_CARET, |
| 516 IA2_TEXT_OFFSET_LENGTH)); | 534 IA2_TEXT_OFFSET_LENGTH)); |
| 517 | 535 |
| 518 EXPECT_HRESULT_FAILED(text_field->setSelection(1, 0, 0)); | 536 EXPECT_HRESULT_FAILED(text_field->setSelection(1, 0, 0)); |
| 519 EXPECT_HRESULT_FAILED(text_field->setSelection(0, 0, 5)); | 537 EXPECT_HRESULT_FAILED(text_field->setSelection(0, 0, 5)); |
| 520 } | 538 } |
| 521 | 539 |
| 522 } // namespace ui | 540 } // namespace ui |
| OLD | NEW |