| 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 <stddef.h> | 5 #include <stddef.h> |
| 6 #include <stdint.h> | 6 #include <stdint.h> |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 ASSERT_NE(nullptr, input_text); | 133 ASSERT_NE(nullptr, input_text); |
| 134 LoadInitialAccessibilityTreeFromHtml(std::string("<!DOCTYPE html><html><body>" | 134 LoadInitialAccessibilityTreeFromHtml(std::string("<!DOCTYPE html><html><body>" |
| 135 "<form><label for='textField'>Browser name:</label>" | 135 "<form><label for='textField'>Browser name:</label>" |
| 136 "<input type='text' id='textField' name='name' value='") + | 136 "<input type='text' id='textField' name='name' value='") + |
| 137 net::EscapeQueryParamValue(INPUT_CONTENTS, false) + std::string( | 137 net::EscapeQueryParamValue(INPUT_CONTENTS, false) + std::string( |
| 138 "'></form></body></html>")); | 138 "'></form></body></html>")); |
| 139 | 139 |
| 140 // Retrieve the IAccessible interface for the web page. | 140 // Retrieve the IAccessible interface for the web page. |
| 141 base::win::ScopedComPtr<IAccessible> document(GetRendererAccessible()); | 141 base::win::ScopedComPtr<IAccessible> document(GetRendererAccessible()); |
| 142 std::vector<base::win::ScopedVariant> document_children = | 142 std::vector<base::win::ScopedVariant> document_children = |
| 143 GetAllAccessibleChildren(document.get()); | 143 GetAllAccessibleChildren(document.Get()); |
| 144 ASSERT_EQ(1u, document_children.size()); | 144 ASSERT_EQ(1u, document_children.size()); |
| 145 | 145 |
| 146 base::win::ScopedComPtr<IAccessible2> form; | 146 base::win::ScopedComPtr<IAccessible2> form; |
| 147 ASSERT_HRESULT_SUCCEEDED(QueryIAccessible2( | 147 ASSERT_HRESULT_SUCCEEDED(QueryIAccessible2( |
| 148 GetAccessibleFromVariant(document.get(), document_children[0].AsInput()) | 148 GetAccessibleFromVariant(document.Get(), document_children[0].AsInput()) |
| 149 .get(), | 149 .Get(), |
| 150 form.Receive())); | 150 form.Receive())); |
| 151 std::vector<base::win::ScopedVariant> form_children = | 151 std::vector<base::win::ScopedVariant> form_children = |
| 152 GetAllAccessibleChildren(form.get()); | 152 GetAllAccessibleChildren(form.Get()); |
| 153 ASSERT_EQ(2u, form_children.size()); | 153 ASSERT_EQ(2u, form_children.size()); |
| 154 | 154 |
| 155 // Find the input text field. | 155 // Find the input text field. |
| 156 base::win::ScopedComPtr<IAccessible2> input; | 156 base::win::ScopedComPtr<IAccessible2> input; |
| 157 ASSERT_HRESULT_SUCCEEDED(QueryIAccessible2( | 157 ASSERT_HRESULT_SUCCEEDED(QueryIAccessible2( |
| 158 GetAccessibleFromVariant(form.get(), form_children[1].AsInput()).get(), | 158 GetAccessibleFromVariant(form.Get(), form_children[1].AsInput()).Get(), |
| 159 input.Receive())); | 159 input.Receive())); |
| 160 LONG input_role = 0; | 160 LONG input_role = 0; |
| 161 ASSERT_HRESULT_SUCCEEDED(input->role(&input_role)); | 161 ASSERT_HRESULT_SUCCEEDED(input->role(&input_role)); |
| 162 ASSERT_EQ(ROLE_SYSTEM_TEXT, input_role); | 162 ASSERT_EQ(ROLE_SYSTEM_TEXT, input_role); |
| 163 | 163 |
| 164 // Retrieve the IAccessibleText interface for the field. | 164 // Retrieve the IAccessibleText interface for the field. |
| 165 ASSERT_HRESULT_SUCCEEDED(input.QueryInterface(input_text->Receive())); | 165 ASSERT_HRESULT_SUCCEEDED(input.QueryInterface(input_text->Receive())); |
| 166 | 166 |
| 167 // Set the caret on the last character. | 167 // Set the caret on the last character. |
| 168 AccessibilityNotificationWaiter waiter(shell()->web_contents(), | 168 AccessibilityNotificationWaiter waiter(shell()->web_contents(), |
| (...skipping 15 matching lines...) Expand all Loading... |
| 184 base::win::ScopedComPtr<IAccessibleText>* textarea_text) { | 184 base::win::ScopedComPtr<IAccessibleText>* textarea_text) { |
| 185 ASSERT_NE(nullptr, textarea_text); | 185 ASSERT_NE(nullptr, textarea_text); |
| 186 LoadInitialAccessibilityTreeFromHtml(std::string("<!DOCTYPE html><html><body>" | 186 LoadInitialAccessibilityTreeFromHtml(std::string("<!DOCTYPE html><html><body>" |
| 187 "<textarea id='textField' rows='3' cols='60'>") + | 187 "<textarea id='textField' rows='3' cols='60'>") + |
| 188 net::EscapeQueryParamValue(TEXTAREA_CONTENTS, false) + std::string( | 188 net::EscapeQueryParamValue(TEXTAREA_CONTENTS, false) + std::string( |
| 189 "</textarea></body></html>")); | 189 "</textarea></body></html>")); |
| 190 | 190 |
| 191 // Retrieve the IAccessible interface for the web page. | 191 // Retrieve the IAccessible interface for the web page. |
| 192 base::win::ScopedComPtr<IAccessible> document(GetRendererAccessible()); | 192 base::win::ScopedComPtr<IAccessible> document(GetRendererAccessible()); |
| 193 std::vector<base::win::ScopedVariant> document_children = | 193 std::vector<base::win::ScopedVariant> document_children = |
| 194 GetAllAccessibleChildren(document.get()); | 194 GetAllAccessibleChildren(document.Get()); |
| 195 ASSERT_EQ(1u, document_children.size()); | 195 ASSERT_EQ(1u, document_children.size()); |
| 196 | 196 |
| 197 base::win::ScopedComPtr<IAccessible2> section; | 197 base::win::ScopedComPtr<IAccessible2> section; |
| 198 ASSERT_HRESULT_SUCCEEDED(QueryIAccessible2( | 198 ASSERT_HRESULT_SUCCEEDED(QueryIAccessible2( |
| 199 GetAccessibleFromVariant(document.get(), document_children[0].AsInput()) | 199 GetAccessibleFromVariant(document.Get(), document_children[0].AsInput()) |
| 200 .get(), | 200 .Get(), |
| 201 section.Receive())); | 201 section.Receive())); |
| 202 std::vector<base::win::ScopedVariant> section_children = | 202 std::vector<base::win::ScopedVariant> section_children = |
| 203 GetAllAccessibleChildren(section.get()); | 203 GetAllAccessibleChildren(section.Get()); |
| 204 ASSERT_EQ(1u, section_children.size()); | 204 ASSERT_EQ(1u, section_children.size()); |
| 205 | 205 |
| 206 // Find the textarea text field. | 206 // Find the textarea text field. |
| 207 base::win::ScopedComPtr<IAccessible2> textarea; | 207 base::win::ScopedComPtr<IAccessible2> textarea; |
| 208 ASSERT_HRESULT_SUCCEEDED(QueryIAccessible2( | 208 ASSERT_HRESULT_SUCCEEDED(QueryIAccessible2( |
| 209 GetAccessibleFromVariant(section.get(), section_children[0].AsInput()) | 209 GetAccessibleFromVariant(section.Get(), section_children[0].AsInput()) |
| 210 .get(), | 210 .Get(), |
| 211 textarea.Receive())); | 211 textarea.Receive())); |
| 212 LONG textarea_role = 0; | 212 LONG textarea_role = 0; |
| 213 ASSERT_HRESULT_SUCCEEDED(textarea->role(&textarea_role)); | 213 ASSERT_HRESULT_SUCCEEDED(textarea->role(&textarea_role)); |
| 214 ASSERT_EQ(ROLE_SYSTEM_TEXT, textarea_role); | 214 ASSERT_EQ(ROLE_SYSTEM_TEXT, textarea_role); |
| 215 | 215 |
| 216 // Retrieve the IAccessibleText interface for the field. | 216 // Retrieve the IAccessibleText interface for the field. |
| 217 ASSERT_HRESULT_SUCCEEDED(textarea.QueryInterface(textarea_text->Receive())); | 217 ASSERT_HRESULT_SUCCEEDED(textarea.QueryInterface(textarea_text->Receive())); |
| 218 | 218 |
| 219 // Set the caret on the last character. | 219 // Set the caret on the last character. |
| 220 AccessibilityNotificationWaiter waiter(shell()->web_contents(), | 220 AccessibilityNotificationWaiter waiter(shell()->web_contents(), |
| (...skipping 20 matching lines...) Expand all Loading... |
| 241 "<body style=\"overflow: scroll; margin-top: 100vh\">" | 241 "<body style=\"overflow: scroll; margin-top: 100vh\">" |
| 242 "<p><b>Game theory</b> is \"the study of " | 242 "<p><b>Game theory</b> is \"the study of " |
| 243 "<a href=\"#\" title=\"Mathematical model\">mathematical models</a> " | 243 "<a href=\"#\" title=\"Mathematical model\">mathematical models</a> " |
| 244 "of conflict and<br>cooperation between intelligent rational " | 244 "of conflict and<br>cooperation between intelligent rational " |
| 245 "decision-makers.\"</p></body></html>", | 245 "decision-makers.\"</p></body></html>", |
| 246 accessibility_mode); | 246 accessibility_mode); |
| 247 | 247 |
| 248 // Retrieve the IAccessible interface for the web page. | 248 // Retrieve the IAccessible interface for the web page. |
| 249 base::win::ScopedComPtr<IAccessible> document(GetRendererAccessible()); | 249 base::win::ScopedComPtr<IAccessible> document(GetRendererAccessible()); |
| 250 std::vector<base::win::ScopedVariant> document_children = | 250 std::vector<base::win::ScopedVariant> document_children = |
| 251 GetAllAccessibleChildren(document.get()); | 251 GetAllAccessibleChildren(document.Get()); |
| 252 ASSERT_EQ(1u, document_children.size()); | 252 ASSERT_EQ(1u, document_children.size()); |
| 253 | 253 |
| 254 base::win::ScopedComPtr<IAccessible2> paragraph; | 254 base::win::ScopedComPtr<IAccessible2> paragraph; |
| 255 ASSERT_HRESULT_SUCCEEDED(QueryIAccessible2( | 255 ASSERT_HRESULT_SUCCEEDED(QueryIAccessible2( |
| 256 GetAccessibleFromVariant(document.get(), document_children[0].AsInput()) | 256 GetAccessibleFromVariant(document.Get(), document_children[0].AsInput()) |
| 257 .get(), | 257 .Get(), |
| 258 paragraph.Receive())); | 258 paragraph.Receive())); |
| 259 LONG paragraph_role = 0; | 259 LONG paragraph_role = 0; |
| 260 ASSERT_HRESULT_SUCCEEDED(paragraph->role(¶graph_role)); | 260 ASSERT_HRESULT_SUCCEEDED(paragraph->role(¶graph_role)); |
| 261 ASSERT_EQ(IA2_ROLE_PARAGRAPH, paragraph_role); | 261 ASSERT_EQ(IA2_ROLE_PARAGRAPH, paragraph_role); |
| 262 ASSERT_HRESULT_SUCCEEDED(paragraph.QueryInterface(com_interface->Receive())); | 262 ASSERT_HRESULT_SUCCEEDED(paragraph.QueryInterface(com_interface->Receive())); |
| 263 } | 263 } |
| 264 | 264 |
| 265 // Static helpers ------------------------------------------------ | 265 // Static helpers ------------------------------------------------ |
| 266 | 266 |
| 267 base::win::ScopedComPtr<IAccessible> | 267 base::win::ScopedComPtr<IAccessible> |
| 268 AccessibilityWinBrowserTest::GetAccessibleFromVariant( | 268 AccessibilityWinBrowserTest::GetAccessibleFromVariant( |
| 269 IAccessible* parent, | 269 IAccessible* parent, |
| 270 VARIANT* var) { | 270 VARIANT* var) { |
| 271 base::win::ScopedComPtr<IAccessible> ptr; | 271 base::win::ScopedComPtr<IAccessible> ptr; |
| 272 switch (V_VT(var)) { | 272 switch (V_VT(var)) { |
| 273 case VT_DISPATCH: { | 273 case VT_DISPATCH: { |
| 274 IDispatch* dispatch = V_DISPATCH(var); | 274 IDispatch* dispatch = V_DISPATCH(var); |
| 275 if (dispatch) | 275 if (dispatch) |
| 276 dispatch->QueryInterface(ptr.Receive()); | 276 dispatch->QueryInterface(ptr.Receive()); |
| 277 break; | 277 break; |
| 278 } | 278 } |
| 279 | 279 |
| 280 case VT_I4: { | 280 case VT_I4: { |
| 281 base::win::ScopedComPtr<IDispatch> dispatch; | 281 base::win::ScopedComPtr<IDispatch> dispatch; |
| 282 HRESULT hr = parent->get_accChild(*var, dispatch.Receive()); | 282 HRESULT hr = parent->get_accChild(*var, dispatch.Receive()); |
| 283 EXPECT_TRUE(SUCCEEDED(hr)); | 283 EXPECT_TRUE(SUCCEEDED(hr)); |
| 284 if (dispatch.get()) | 284 if (dispatch.Get()) |
| 285 dispatch.QueryInterface(ptr.Receive()); | 285 dispatch.QueryInterface(ptr.Receive()); |
| 286 break; | 286 break; |
| 287 } | 287 } |
| 288 } | 288 } |
| 289 return ptr; | 289 return ptr; |
| 290 } | 290 } |
| 291 | 291 |
| 292 HRESULT AccessibilityWinBrowserTest::QueryIAccessible2( | 292 HRESULT AccessibilityWinBrowserTest::QueryIAccessible2( |
| 293 IAccessible* accessible, | 293 IAccessible* accessible, |
| 294 IAccessible2** accessible2) { | 294 IAccessible2** accessible2) { |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 330 return; | 330 return; |
| 331 } | 331 } |
| 332 | 332 |
| 333 std::vector<base::win::ScopedVariant> children = GetAllAccessibleChildren( | 333 std::vector<base::win::ScopedVariant> children = GetAllAccessibleChildren( |
| 334 node); | 334 node); |
| 335 for (size_t i = 0; i < children.size(); ++i) { | 335 for (size_t i = 0; i < children.size(); ++i) { |
| 336 base::win::ScopedComPtr<IAccessible> child_accessible( | 336 base::win::ScopedComPtr<IAccessible> child_accessible( |
| 337 GetAccessibleFromVariant(node, children[i].AsInput())); | 337 GetAccessibleFromVariant(node, children[i].AsInput())); |
| 338 if (child_accessible) { | 338 if (child_accessible) { |
| 339 FindNodeInAccessibilityTree( | 339 FindNodeInAccessibilityTree( |
| 340 child_accessible.get(), expected_role, expected_name, depth + 1, | 340 child_accessible.Get(), expected_role, expected_name, depth + 1, |
| 341 found); | 341 found); |
| 342 if (*found) | 342 if (*found) |
| 343 return; | 343 return; |
| 344 } | 344 } |
| 345 } | 345 } |
| 346 } | 346 } |
| 347 | 347 |
| 348 // Ensures that the text and the start and end offsets retrieved using | 348 // Ensures that the text and the start and end offsets retrieved using |
| 349 // get_textAtOffset match the expected values. | 349 // get_textAtOffset match the expected values. |
| 350 void AccessibilityWinBrowserTest::CheckTextAtOffset( | 350 void AccessibilityWinBrowserTest::CheckTextAtOffset( |
| (...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 608 | 608 |
| 609 AccessibleCheckerVector::iterator child_checker; | 609 AccessibleCheckerVector::iterator child_checker; |
| 610 std::vector<base::win::ScopedVariant>::iterator child; | 610 std::vector<base::win::ScopedVariant>::iterator child; |
| 611 for (child_checker = children_.begin(), | 611 for (child_checker = children_.begin(), |
| 612 child = obtained_children.begin(); | 612 child = obtained_children.begin(); |
| 613 child_checker != children_.end() | 613 child_checker != children_.end() |
| 614 && child != obtained_children.end(); | 614 && child != obtained_children.end(); |
| 615 ++child_checker, ++child) { | 615 ++child_checker, ++child) { |
| 616 base::win::ScopedComPtr<IAccessible> child_accessible( | 616 base::win::ScopedComPtr<IAccessible> child_accessible( |
| 617 GetAccessibleFromVariant(parent, child->AsInput())); | 617 GetAccessibleFromVariant(parent, child->AsInput())); |
| 618 ASSERT_TRUE(child_accessible.get()); | 618 ASSERT_TRUE(child_accessible.Get()); |
| 619 (*child_checker)->CheckAccessible(child_accessible.get()); | 619 (*child_checker)->CheckAccessible(child_accessible.Get()); |
| 620 } | 620 } |
| 621 } | 621 } |
| 622 | 622 |
| 623 base::string16 | 623 base::string16 |
| 624 AccessibilityWinBrowserTest::AccessibleChecker::RoleVariantToString( | 624 AccessibilityWinBrowserTest::AccessibleChecker::RoleVariantToString( |
| 625 const base::win::ScopedVariant& role) { | 625 const base::win::ScopedVariant& role) { |
| 626 if (role.type() == VT_I4) | 626 if (role.type() == VT_I4) |
| 627 return IAccessibleRoleToString(V_I4(role.ptr())); | 627 return IAccessibleRoleToString(V_I4(role.ptr())); |
| 628 if (role.type() == VT_BSTR) | 628 if (role.type() == VT_BSTR) |
| 629 return base::string16(V_BSTR(role.ptr()), SysStringLen(V_BSTR(role.ptr()))); | 629 return base::string16(V_BSTR(role.ptr()), SysStringLen(V_BSTR(role.ptr()))); |
| (...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 817 SCOPED_TRACE("Check updated tree after focusing div"); | 817 SCOPED_TRACE("Check updated tree after focusing div"); |
| 818 group_checker.SetExpectedState( | 818 group_checker.SetExpectedState( |
| 819 STATE_SYSTEM_FOCUSABLE | STATE_SYSTEM_FOCUSED); | 819 STATE_SYSTEM_FOCUSABLE | STATE_SYSTEM_FOCUSED); |
| 820 document_checker.CheckAccessible(GetRendererAccessible()); | 820 document_checker.CheckAccessible(GetRendererAccessible()); |
| 821 | 821 |
| 822 // Focus the document accessible. This will un-focus the current node. | 822 // Focus the document accessible. This will un-focus the current node. |
| 823 waiter.reset(new AccessibilityNotificationWaiter( | 823 waiter.reset(new AccessibilityNotificationWaiter( |
| 824 shell()->web_contents(), kAccessibilityModeComplete, ui::AX_EVENT_BLUR)); | 824 shell()->web_contents(), kAccessibilityModeComplete, ui::AX_EVENT_BLUR)); |
| 825 base::win::ScopedComPtr<IAccessible> document_accessible( | 825 base::win::ScopedComPtr<IAccessible> document_accessible( |
| 826 GetRendererAccessible()); | 826 GetRendererAccessible()); |
| 827 ASSERT_NE(document_accessible.get(), reinterpret_cast<IAccessible*>(NULL)); | 827 ASSERT_NE(document_accessible.Get(), reinterpret_cast<IAccessible*>(NULL)); |
| 828 base::win::ScopedVariant childid_self(CHILDID_SELF); | 828 base::win::ScopedVariant childid_self(CHILDID_SELF); |
| 829 HRESULT hr = document_accessible->accSelect(SELFLAG_TAKEFOCUS, childid_self); | 829 HRESULT hr = document_accessible->accSelect(SELFLAG_TAKEFOCUS, childid_self); |
| 830 ASSERT_EQ(S_OK, hr); | 830 ASSERT_EQ(S_OK, hr); |
| 831 waiter->WaitForNotification(); | 831 waiter->WaitForNotification(); |
| 832 | 832 |
| 833 // Check that the accessibility tree of the browser has been updated. | 833 // Check that the accessibility tree of the browser has been updated. |
| 834 SCOPED_TRACE("Check updated tree after focusing document again"); | 834 SCOPED_TRACE("Check updated tree after focusing document again"); |
| 835 group_checker.SetExpectedState(STATE_SYSTEM_FOCUSABLE); | 835 group_checker.SetExpectedState(STATE_SYSTEM_FOCUSABLE); |
| 836 document_checker.CheckAccessible(GetRendererAccessible()); | 836 document_checker.CheckAccessible(GetRendererAccessible()); |
| 837 } | 837 } |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 891 base::win::ScopedComPtr<IAccessible> browser_accessible; | 891 base::win::ScopedComPtr<IAccessible> browser_accessible; |
| 892 HRESULT hr = AccessibleObjectFromWindow( | 892 HRESULT hr = AccessibleObjectFromWindow( |
| 893 hwnd, | 893 hwnd, |
| 894 OBJID_WINDOW, | 894 OBJID_WINDOW, |
| 895 IID_IAccessible, | 895 IID_IAccessible, |
| 896 reinterpret_cast<void**>(browser_accessible.Receive())); | 896 reinterpret_cast<void**>(browser_accessible.Receive())); |
| 897 ASSERT_EQ(S_OK, hr); | 897 ASSERT_EQ(S_OK, hr); |
| 898 | 898 |
| 899 bool found = false; | 899 bool found = false; |
| 900 FindNodeInAccessibilityTree( | 900 FindNodeInAccessibilityTree( |
| 901 browser_accessible.get(), ROLE_SYSTEM_DOCUMENT, L"MyDocument", 0, &found); | 901 browser_accessible.Get(), ROLE_SYSTEM_DOCUMENT, L"MyDocument", 0, &found); |
| 902 ASSERT_EQ(found, true); | 902 ASSERT_EQ(found, true); |
| 903 } | 903 } |
| 904 | 904 |
| 905 IN_PROC_BROWSER_TEST_F(AccessibilityWinBrowserTest, | 905 IN_PROC_BROWSER_TEST_F(AccessibilityWinBrowserTest, |
| 906 SupportsISimpleDOM) { | 906 SupportsISimpleDOM) { |
| 907 LoadInitialAccessibilityTreeFromHtml( | 907 LoadInitialAccessibilityTreeFromHtml( |
| 908 "<body><input type='checkbox'></body>"); | 908 "<body><input type='checkbox'></body>"); |
| 909 | 909 |
| 910 // Get the IAccessible object for the document. | 910 // Get the IAccessible object for the document. |
| 911 base::win::ScopedComPtr<IAccessible> document_accessible( | 911 base::win::ScopedComPtr<IAccessible> document_accessible( |
| 912 GetRendererAccessible()); | 912 GetRendererAccessible()); |
| 913 ASSERT_NE(document_accessible.get(), reinterpret_cast<IAccessible*>(NULL)); | 913 ASSERT_NE(document_accessible.Get(), reinterpret_cast<IAccessible*>(NULL)); |
| 914 | 914 |
| 915 // Get the ISimpleDOM object for the document. | 915 // Get the ISimpleDOM object for the document. |
| 916 base::win::ScopedComPtr<IServiceProvider> service_provider; | 916 base::win::ScopedComPtr<IServiceProvider> service_provider; |
| 917 HRESULT hr = static_cast<IAccessible*>(document_accessible.get()) | 917 HRESULT hr = static_cast<IAccessible*>(document_accessible.Get()) |
| 918 ->QueryInterface(service_provider.Receive()); | 918 ->QueryInterface(service_provider.Receive()); |
| 919 ASSERT_EQ(S_OK, hr); | 919 ASSERT_EQ(S_OK, hr); |
| 920 const GUID refguid = {0x0c539790, | 920 const GUID refguid = {0x0c539790, |
| 921 0x12e4, | 921 0x12e4, |
| 922 0x11cf, | 922 0x11cf, |
| 923 {0xb6, 0x61, 0x00, 0xaa, 0x00, 0x4c, 0xd6, 0xd8}}; | 923 {0xb6, 0x61, 0x00, 0xaa, 0x00, 0x4c, 0xd6, 0xd8}}; |
| 924 base::win::ScopedComPtr<ISimpleDOMNode> document_isimpledomnode; | 924 base::win::ScopedComPtr<ISimpleDOMNode> document_isimpledomnode; |
| 925 hr = static_cast<IServiceProvider*>(service_provider.get()) | 925 hr = static_cast<IServiceProvider*>(service_provider.Get()) |
| 926 ->QueryService( | 926 ->QueryService( |
| 927 refguid, IID_ISimpleDOMNode, | 927 refguid, IID_ISimpleDOMNode, |
| 928 reinterpret_cast<void**>(document_isimpledomnode.Receive())); | 928 reinterpret_cast<void**>(document_isimpledomnode.Receive())); |
| 929 ASSERT_EQ(S_OK, hr); | 929 ASSERT_EQ(S_OK, hr); |
| 930 | 930 |
| 931 base::win::ScopedBstr node_name; | 931 base::win::ScopedBstr node_name; |
| 932 short name_space_id; // NOLINT | 932 short name_space_id; // NOLINT |
| 933 base::win::ScopedBstr node_value; | 933 base::win::ScopedBstr node_value; |
| 934 unsigned int num_children; | 934 unsigned int num_children; |
| 935 unsigned int unique_id; | 935 unsigned int unique_id; |
| (...skipping 915 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1851 IN_PROC_BROWSER_TEST_F(AccessibilityWinBrowserTest, TestIAccessibleAction) { | 1851 IN_PROC_BROWSER_TEST_F(AccessibilityWinBrowserTest, TestIAccessibleAction) { |
| 1852 LoadInitialAccessibilityTreeFromHtml( | 1852 LoadInitialAccessibilityTreeFromHtml( |
| 1853 "<!DOCTYPE html><html><body>" | 1853 "<!DOCTYPE html><html><body>" |
| 1854 "<img src=\"\" alt=\"image\" " | 1854 "<img src=\"\" alt=\"image\" " |
| 1855 "onclick=\"document.querySelector('img').alt = 'image2';\">" | 1855 "onclick=\"document.querySelector('img').alt = 'image2';\">" |
| 1856 "</body></html>"); | 1856 "</body></html>"); |
| 1857 | 1857 |
| 1858 // Retrieve the IAccessible interface for the web page. | 1858 // Retrieve the IAccessible interface for the web page. |
| 1859 base::win::ScopedComPtr<IAccessible> document(GetRendererAccessible()); | 1859 base::win::ScopedComPtr<IAccessible> document(GetRendererAccessible()); |
| 1860 std::vector<base::win::ScopedVariant> document_children = | 1860 std::vector<base::win::ScopedVariant> document_children = |
| 1861 GetAllAccessibleChildren(document.get()); | 1861 GetAllAccessibleChildren(document.Get()); |
| 1862 ASSERT_EQ(1u, document_children.size()); | 1862 ASSERT_EQ(1u, document_children.size()); |
| 1863 | 1863 |
| 1864 base::win::ScopedComPtr<IAccessible2> div; | 1864 base::win::ScopedComPtr<IAccessible2> div; |
| 1865 ASSERT_HRESULT_SUCCEEDED(QueryIAccessible2( | 1865 ASSERT_HRESULT_SUCCEEDED(QueryIAccessible2( |
| 1866 GetAccessibleFromVariant(document.get(), document_children[0].AsInput()) | 1866 GetAccessibleFromVariant(document.Get(), document_children[0].AsInput()) |
| 1867 .get(), | 1867 .Get(), |
| 1868 div.Receive())); | 1868 div.Receive())); |
| 1869 std::vector<base::win::ScopedVariant> div_children = | 1869 std::vector<base::win::ScopedVariant> div_children = |
| 1870 GetAllAccessibleChildren(div.get()); | 1870 GetAllAccessibleChildren(div.Get()); |
| 1871 ASSERT_EQ(1u, div_children.size()); | 1871 ASSERT_EQ(1u, div_children.size()); |
| 1872 | 1872 |
| 1873 base::win::ScopedComPtr<IAccessible2> image; | 1873 base::win::ScopedComPtr<IAccessible2> image; |
| 1874 ASSERT_HRESULT_SUCCEEDED(QueryIAccessible2( | 1874 ASSERT_HRESULT_SUCCEEDED(QueryIAccessible2( |
| 1875 GetAccessibleFromVariant(div.get(), div_children[0].AsInput()).get(), | 1875 GetAccessibleFromVariant(div.Get(), div_children[0].AsInput()).Get(), |
| 1876 image.Receive())); | 1876 image.Receive())); |
| 1877 LONG image_role = 0; | 1877 LONG image_role = 0; |
| 1878 ASSERT_HRESULT_SUCCEEDED(image->role(&image_role)); | 1878 ASSERT_HRESULT_SUCCEEDED(image->role(&image_role)); |
| 1879 ASSERT_EQ(ROLE_SYSTEM_GRAPHIC, image_role); | 1879 ASSERT_EQ(ROLE_SYSTEM_GRAPHIC, image_role); |
| 1880 | 1880 |
| 1881 base::win::ScopedComPtr<IAccessibleAction> image_action; | 1881 base::win::ScopedComPtr<IAccessibleAction> image_action; |
| 1882 ASSERT_HRESULT_SUCCEEDED(image.QueryInterface(image_action.Receive())); | 1882 ASSERT_HRESULT_SUCCEEDED(image.QueryInterface(image_action.Receive())); |
| 1883 | 1883 |
| 1884 LONG n_actions = 0; | 1884 LONG n_actions = 0; |
| 1885 EXPECT_HRESULT_SUCCEEDED(image_action->nActions(&n_actions)); | 1885 EXPECT_HRESULT_SUCCEEDED(image_action->nActions(&n_actions)); |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1954 ASSERT_TRUE(embedded_test_server()->Start()); | 1954 ASSERT_TRUE(embedded_test_server()->Start()); |
| 1955 AccessibilityNotificationWaiter waiter(shell()->web_contents(), | 1955 AccessibilityNotificationWaiter waiter(shell()->web_contents(), |
| 1956 kAccessibilityModeComplete, | 1956 kAccessibilityModeComplete, |
| 1957 ui::AX_EVENT_LOAD_COMPLETE); | 1957 ui::AX_EVENT_LOAD_COMPLETE); |
| 1958 NavigateToURL(shell(), embedded_test_server()->GetURL( | 1958 NavigateToURL(shell(), embedded_test_server()->GetURL( |
| 1959 "/accessibility/html/table-spans.html")); | 1959 "/accessibility/html/table-spans.html")); |
| 1960 waiter.WaitForNotification(); | 1960 waiter.WaitForNotification(); |
| 1961 | 1961 |
| 1962 base::win::ScopedComPtr<IAccessible> document(GetRendererAccessible()); | 1962 base::win::ScopedComPtr<IAccessible> document(GetRendererAccessible()); |
| 1963 std::vector<base::win::ScopedVariant> document_children = | 1963 std::vector<base::win::ScopedVariant> document_children = |
| 1964 GetAllAccessibleChildren(document.get()); | 1964 GetAllAccessibleChildren(document.Get()); |
| 1965 // There are two tables in this test file. Use only the first one. | 1965 // There are two tables in this test file. Use only the first one. |
| 1966 ASSERT_EQ(2u, document_children.size()); | 1966 ASSERT_EQ(2u, document_children.size()); |
| 1967 | 1967 |
| 1968 base::win::ScopedComPtr<IAccessible2> table; | 1968 base::win::ScopedComPtr<IAccessible2> table; |
| 1969 ASSERT_HRESULT_SUCCEEDED(QueryIAccessible2( | 1969 ASSERT_HRESULT_SUCCEEDED(QueryIAccessible2( |
| 1970 GetAccessibleFromVariant(document.get(), document_children[0].AsInput()) | 1970 GetAccessibleFromVariant(document.Get(), document_children[0].AsInput()) |
| 1971 .get(), | 1971 .Get(), |
| 1972 table.Receive())); | 1972 table.Receive())); |
| 1973 LONG role = 0; | 1973 LONG role = 0; |
| 1974 ASSERT_HRESULT_SUCCEEDED(table->role(&role)); | 1974 ASSERT_HRESULT_SUCCEEDED(table->role(&role)); |
| 1975 ASSERT_EQ(ROLE_SYSTEM_TABLE, role); | 1975 ASSERT_EQ(ROLE_SYSTEM_TABLE, role); |
| 1976 | 1976 |
| 1977 // Retrieve the first cell. | 1977 // Retrieve the first cell. |
| 1978 base::win::ScopedComPtr<IAccessibleTable2> table2; | 1978 base::win::ScopedComPtr<IAccessibleTable2> table2; |
| 1979 base::win::ScopedComPtr<IUnknown> cell; | 1979 base::win::ScopedComPtr<IUnknown> cell; |
| 1980 base::win::ScopedComPtr<IAccessible2> cell1; | 1980 base::win::ScopedComPtr<IAccessible2> cell1; |
| 1981 EXPECT_HRESULT_SUCCEEDED(table.QueryInterface(table2.Receive())); | 1981 EXPECT_HRESULT_SUCCEEDED(table.QueryInterface(table2.Receive())); |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2041 EXPECT_HRESULT_SUCCEEDED(accessible_cell->get_rowIndex(&row_index)); | 2041 EXPECT_HRESULT_SUCCEEDED(accessible_cell->get_rowIndex(&row_index)); |
| 2042 EXPECT_HRESULT_SUCCEEDED(accessible_cell->get_columnIndex(&column_index)); | 2042 EXPECT_HRESULT_SUCCEEDED(accessible_cell->get_columnIndex(&column_index)); |
| 2043 EXPECT_EQ(1, row_index); | 2043 EXPECT_EQ(1, row_index); |
| 2044 EXPECT_EQ(1, column_index); | 2044 EXPECT_EQ(1, column_index); |
| 2045 variant.Reset(); | 2045 variant.Reset(); |
| 2046 name.Reset(); | 2046 name.Reset(); |
| 2047 accessible_cell.Reset(); | 2047 accessible_cell.Reset(); |
| 2048 } | 2048 } |
| 2049 | 2049 |
| 2050 } // namespace content | 2050 } // namespace content |
| OLD | NEW |