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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 } | 90 } |
91 | 91 |
92 ScopedComPtr<IAccessible> GetRootIAccessible() { | 92 ScopedComPtr<IAccessible> GetRootIAccessible() { |
93 return IAccessibleFromNode(GetRootNode()); | 93 return IAccessibleFromNode(GetRootNode()); |
94 } | 94 } |
95 | 95 |
96 ScopedComPtr<IAccessible2> ToIAccessible2( | 96 ScopedComPtr<IAccessible2> ToIAccessible2( |
97 ScopedComPtr<IAccessible> accessible) { | 97 ScopedComPtr<IAccessible> accessible) { |
98 CHECK(accessible.Get()); | 98 CHECK(accessible.Get()); |
99 ScopedComPtr<IServiceProvider> service_provider; | 99 ScopedComPtr<IServiceProvider> service_provider; |
100 service_provider.QueryFrom(accessible.Get()); | 100 accessible.CopyTo(service_provider.GetAddressOf()); |
101 ScopedComPtr<IAccessible2> result; | 101 ScopedComPtr<IAccessible2> result; |
102 CHECK(SUCCEEDED(service_provider->QueryService(IID_IAccessible2, | 102 CHECK(SUCCEEDED(service_provider->QueryService(IID_IAccessible2, |
103 result.GetAddressOf()))); | 103 result.GetAddressOf()))); |
104 return result; | 104 return result; |
105 } | 105 } |
106 | 106 |
107 std::unique_ptr<AXTree> tree_; | 107 std::unique_ptr<AXTree> tree_; |
108 }; | 108 }; |
109 | 109 |
110 TEST_F(AXPlatformNodeWinTest, TestIAccessibleDetachedObject) { | 110 TEST_F(AXPlatformNodeWinTest, TestIAccessibleDetachedObject) { |
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
405 AXNodeData text_field_node; | 405 AXNodeData text_field_node; |
406 text_field_node.id = 1; | 406 text_field_node.id = 1; |
407 text_field_node.role = ui::AX_ROLE_TEXT_FIELD; | 407 text_field_node.role = ui::AX_ROLE_TEXT_FIELD; |
408 text_field_node.state = 1 << ui::AX_STATE_EDITABLE; | 408 text_field_node.state = 1 << ui::AX_STATE_EDITABLE; |
409 text_field_node.SetValue("Hi"); | 409 text_field_node.SetValue("Hi"); |
410 | 410 |
411 Init(text_field_node); | 411 Init(text_field_node); |
412 ScopedComPtr<IAccessible2> ia2_text_field = | 412 ScopedComPtr<IAccessible2> ia2_text_field = |
413 ToIAccessible2(GetRootIAccessible()); | 413 ToIAccessible2(GetRootIAccessible()); |
414 ScopedComPtr<IAccessibleText> text_field; | 414 ScopedComPtr<IAccessibleText> text_field; |
415 text_field.QueryFrom(ia2_text_field.Get()); | 415 ia2_text_field.CopyTo(text_field.GetAddressOf()); |
416 ASSERT_NE(nullptr, text_field); | 416 ASSERT_NE(nullptr, text_field); |
417 | 417 |
418 EXPECT_HRESULT_SUCCEEDED(text_field->setSelection(0, 0, 1)); | 418 EXPECT_HRESULT_SUCCEEDED(text_field->setSelection(0, 0, 1)); |
419 EXPECT_HRESULT_SUCCEEDED(text_field->setSelection(0, 1, 0)); | 419 EXPECT_HRESULT_SUCCEEDED(text_field->setSelection(0, 1, 0)); |
420 EXPECT_HRESULT_SUCCEEDED(text_field->setSelection(0, 2, 2)); | 420 EXPECT_HRESULT_SUCCEEDED(text_field->setSelection(0, 2, 2)); |
421 EXPECT_HRESULT_SUCCEEDED(text_field->setSelection(0, IA2_TEXT_OFFSET_CARET, | 421 EXPECT_HRESULT_SUCCEEDED(text_field->setSelection(0, IA2_TEXT_OFFSET_CARET, |
422 IA2_TEXT_OFFSET_LENGTH)); | 422 IA2_TEXT_OFFSET_LENGTH)); |
423 | 423 |
424 EXPECT_HRESULT_FAILED(text_field->setSelection(1, 0, 0)); | 424 EXPECT_HRESULT_FAILED(text_field->setSelection(1, 0, 0)); |
425 EXPECT_HRESULT_FAILED(text_field->setSelection(0, 0, 5)); | 425 EXPECT_HRESULT_FAILED(text_field->setSelection(0, 0, 5)); |
426 } | 426 } |
427 | 427 |
428 } // namespace ui | 428 } // namespace ui |
OLD | NEW |