| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <vector> | 6 #include <vector> |
| 7 | 7 |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
| 10 #include "base/win/scoped_comptr.h" | 10 #include "base/win/scoped_comptr.h" |
| (...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 319 for (AccessibleCheckerVector::iterator child_checker = children_.begin(); | 319 for (AccessibleCheckerVector::iterator child_checker = children_.begin(); |
| 320 child_checker != children_.end(); | 320 child_checker != children_.end(); |
| 321 ++child_checker, ++child) { | 321 ++child_checker, ++child) { |
| 322 base::win::ScopedComPtr<IAccessible> child_accessible; | 322 base::win::ScopedComPtr<IAccessible> child_accessible; |
| 323 child_accessible.Attach(GetAccessibleFromResultVariant(parent, child)); | 323 child_accessible.Attach(GetAccessibleFromResultVariant(parent, child)); |
| 324 ASSERT_TRUE(child_accessible.get()); | 324 ASSERT_TRUE(child_accessible.get()); |
| 325 (*child_checker)->CheckAccessible(child_accessible); | 325 (*child_checker)->CheckAccessible(child_accessible); |
| 326 } | 326 } |
| 327 } | 327 } |
| 328 | 328 |
| 329 // See http://crbug.com/102725 | 329 // See http://crbug.com/102725 and http://crbug.com/106957. |
| 330 IN_PROC_BROWSER_TEST_F(AccessibilityWinBrowserTest, | 330 IN_PROC_BROWSER_TEST_F(AccessibilityWinBrowserTest, |
| 331 FAILS_TestRendererAccessibilityTree) { | 331 DISABLED_TestRendererAccessibilityTree) { |
| 332 ui_test_utils::WindowedNotificationObserver tree_updated_observer1( | 332 ui_test_utils::WindowedNotificationObserver tree_updated_observer1( |
| 333 content::NOTIFICATION_RENDER_VIEW_HOST_ACCESSIBILITY_TREE_UPDATED, | 333 content::NOTIFICATION_RENDER_VIEW_HOST_ACCESSIBILITY_TREE_UPDATED, |
| 334 content::NotificationService::AllSources()); | 334 content::NotificationService::AllSources()); |
| 335 | 335 |
| 336 // The initial accessible returned should have state STATE_SYSTEM_BUSY while | 336 // The initial accessible returned should have state STATE_SYSTEM_BUSY while |
| 337 // the accessibility tree is being requested from the renderer. | 337 // the accessibility tree is being requested from the renderer. |
| 338 AccessibleChecker document1_checker(L"", ROLE_SYSTEM_DOCUMENT, L""); | 338 AccessibleChecker document1_checker(L"", ROLE_SYSTEM_DOCUMENT, L""); |
| 339 document1_checker.SetExpectedState( | 339 document1_checker.SetExpectedState( |
| 340 STATE_SYSTEM_READONLY | STATE_SYSTEM_FOCUSABLE | STATE_SYSTEM_FOCUSED | | 340 STATE_SYSTEM_READONLY | STATE_SYSTEM_FOCUSABLE | STATE_SYSTEM_FOCUSED | |
| 341 STATE_SYSTEM_BUSY); | 341 STATE_SYSTEM_BUSY); |
| (...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 590 SELFLAG_TAKEFOCUS, CreateI4Variant(CHILDID_SELF)); | 590 SELFLAG_TAKEFOCUS, CreateI4Variant(CHILDID_SELF)); |
| 591 ASSERT_EQ(S_OK, hr); | 591 ASSERT_EQ(S_OK, hr); |
| 592 tree_updated_observer3.Wait(); | 592 tree_updated_observer3.Wait(); |
| 593 | 593 |
| 594 // Check that the accessibility tree of the browser has been updated. | 594 // Check that the accessibility tree of the browser has been updated. |
| 595 div_checker.SetExpectedState( | 595 div_checker.SetExpectedState( |
| 596 STATE_SYSTEM_FOCUSABLE | STATE_SYSTEM_READONLY); | 596 STATE_SYSTEM_FOCUSABLE | STATE_SYSTEM_READONLY); |
| 597 document_checker.CheckAccessible(GetRendererAccessible()); | 597 document_checker.CheckAccessible(GetRendererAccessible()); |
| 598 } | 598 } |
| 599 | 599 |
| 600 // Disabled, see http://crbug.com/106957 . |
| 600 IN_PROC_BROWSER_TEST_F(AccessibilityWinBrowserTest, | 601 IN_PROC_BROWSER_TEST_F(AccessibilityWinBrowserTest, |
| 601 TestNotificationValueChanged) { | 602 DISABLED_TestNotificationValueChanged) { |
| 602 ui_test_utils::WindowedNotificationObserver tree_updated_observer1( | 603 ui_test_utils::WindowedNotificationObserver tree_updated_observer1( |
| 603 content::NOTIFICATION_RENDER_VIEW_HOST_ACCESSIBILITY_TREE_UPDATED, | 604 content::NOTIFICATION_RENDER_VIEW_HOST_ACCESSIBILITY_TREE_UPDATED, |
| 604 content::NotificationService::AllSources()); | 605 content::NotificationService::AllSources()); |
| 605 GURL tree_url("data:text/html,<body><input type='text' value='old value'/>" | 606 GURL tree_url("data:text/html,<body><input type='text' value='old value'/>" |
| 606 "</body>"); | 607 "</body>"); |
| 607 browser()->OpenURL( | 608 browser()->OpenURL( |
| 608 tree_url, GURL(), CURRENT_TAB, content::PAGE_TRANSITION_TYPED); | 609 tree_url, GURL(), CURRENT_TAB, content::PAGE_TRANSITION_TYPED); |
| 609 GetRendererAccessible(); | 610 GetRendererAccessible(); |
| 610 tree_updated_observer1.Wait(); | 611 tree_updated_observer1.Wait(); |
| 611 | 612 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 632 } | 633 } |
| 633 | 634 |
| 634 // This test verifies that the web content's accessibility tree is a | 635 // This test verifies that the web content's accessibility tree is a |
| 635 // descendant of the main browser window's accessibility tree, so that | 636 // descendant of the main browser window's accessibility tree, so that |
| 636 // tools like AccExplorer32 or AccProbe can be used to examine Chrome's | 637 // tools like AccExplorer32 or AccProbe can be used to examine Chrome's |
| 637 // accessibility support. | 638 // accessibility support. |
| 638 // | 639 // |
| 639 // If you made a change and this test now fails, check that the NativeViewHost | 640 // If you made a change and this test now fails, check that the NativeViewHost |
| 640 // that wraps the tab contents returns the IAccessible implementation | 641 // that wraps the tab contents returns the IAccessible implementation |
| 641 // provided by RenderWidgetHostViewWin in GetNativeViewAccessible(). | 642 // provided by RenderWidgetHostViewWin in GetNativeViewAccessible(). |
| 643 // Disabled, see http://crbug.com/106957 . |
| 642 IN_PROC_BROWSER_TEST_F(AccessibilityWinBrowserTest, | 644 IN_PROC_BROWSER_TEST_F(AccessibilityWinBrowserTest, |
| 643 ContainsRendererAccessibilityTree) { | 645 DISABLED_ContainsRendererAccessibilityTree) { |
| 644 ui_test_utils::WindowedNotificationObserver tree_updated_observer1( | 646 ui_test_utils::WindowedNotificationObserver tree_updated_observer1( |
| 645 content::NOTIFICATION_RENDER_VIEW_HOST_ACCESSIBILITY_TREE_UPDATED, | 647 content::NOTIFICATION_RENDER_VIEW_HOST_ACCESSIBILITY_TREE_UPDATED, |
| 646 content::NotificationService::AllSources()); | 648 content::NotificationService::AllSources()); |
| 647 GURL tree_url("data:text/html,<html><head><title>MyDocument</title></head>" | 649 GURL tree_url("data:text/html,<html><head><title>MyDocument</title></head>" |
| 648 "<body>Content</body></html>"); | 650 "<body>Content</body></html>"); |
| 649 browser()->OpenURL( | 651 browser()->OpenURL( |
| 650 tree_url, GURL(), CURRENT_TAB, content::PAGE_TRANSITION_TYPED); | 652 tree_url, GURL(), CURRENT_TAB, content::PAGE_TRANSITION_TYPED); |
| 651 GetRendererAccessible(); | 653 GetRendererAccessible(); |
| 652 tree_updated_observer1.Wait(); | 654 tree_updated_observer1.Wait(); |
| 653 | 655 |
| 654 // Get the accessibility object for the browser window. | 656 // Get the accessibility object for the browser window. |
| 655 HWND browser_hwnd = browser()->window()->GetNativeHandle(); | 657 HWND browser_hwnd = browser()->window()->GetNativeHandle(); |
| 656 base::win::ScopedComPtr<IAccessible> browser_accessible; | 658 base::win::ScopedComPtr<IAccessible> browser_accessible; |
| 657 HRESULT hr = AccessibleObjectFromWindow( | 659 HRESULT hr = AccessibleObjectFromWindow( |
| 658 browser_hwnd, | 660 browser_hwnd, |
| 659 OBJID_WINDOW, | 661 OBJID_WINDOW, |
| 660 IID_IAccessible, | 662 IID_IAccessible, |
| 661 reinterpret_cast<void**>(browser_accessible.Receive())); | 663 reinterpret_cast<void**>(browser_accessible.Receive())); |
| 662 ASSERT_EQ(S_OK, hr); | 664 ASSERT_EQ(S_OK, hr); |
| 663 | 665 |
| 664 bool found = false; | 666 bool found = false; |
| 665 RecursiveFindNodeInAccessibilityTree( | 667 RecursiveFindNodeInAccessibilityTree( |
| 666 browser_accessible.get(), ROLE_SYSTEM_DOCUMENT, L"MyDocument", 0, &found); | 668 browser_accessible.get(), ROLE_SYSTEM_DOCUMENT, L"MyDocument", 0, &found); |
| 667 ASSERT_EQ(found, true); | 669 ASSERT_EQ(found, true); |
| 668 } | 670 } |
| 669 | 671 |
| 672 // Disabled, see http://crbug.com/106957 . |
| 670 IN_PROC_BROWSER_TEST_F(AccessibilityWinBrowserTest, | 673 IN_PROC_BROWSER_TEST_F(AccessibilityWinBrowserTest, |
| 671 SupportsISimpleDOM) { | 674 DISABLED_SupportsISimpleDOM) { |
| 672 ui_test_utils::WindowedNotificationObserver tree_updated_observer1( | 675 ui_test_utils::WindowedNotificationObserver tree_updated_observer1( |
| 673 content::NOTIFICATION_RENDER_VIEW_HOST_ACCESSIBILITY_TREE_UPDATED, | 676 content::NOTIFICATION_RENDER_VIEW_HOST_ACCESSIBILITY_TREE_UPDATED, |
| 674 content::NotificationService::AllSources()); | 677 content::NotificationService::AllSources()); |
| 675 GURL tree_url("data:text/html,<body><input type='checkbox' /></body>"); | 678 GURL tree_url("data:text/html,<body><input type='checkbox' /></body>"); |
| 676 browser()->OpenURL( | 679 browser()->OpenURL( |
| 677 tree_url, GURL(), CURRENT_TAB, content::PAGE_TRANSITION_TYPED); | 680 tree_url, GURL(), CURRENT_TAB, content::PAGE_TRANSITION_TYPED); |
| 678 GetRendererAccessible(); | 681 GetRendererAccessible(); |
| 679 tree_updated_observer1.Wait(); | 682 tree_updated_observer1.Wait(); |
| 680 | 683 |
| 681 // Get the IAccessible object for the document. | 684 // Get the IAccessible object for the document. |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 727 ASSERT_EQ(S_OK, hr); | 730 ASSERT_EQ(S_OK, hr); |
| 728 hr = checkbox_isimpledomnode->get_nodeInfo( | 731 hr = checkbox_isimpledomnode->get_nodeInfo( |
| 729 &node_name, &name_space_id, &node_value, &num_children, &unique_id, | 732 &node_name, &name_space_id, &node_value, &num_children, &unique_id, |
| 730 &node_type); | 733 &node_type); |
| 731 ASSERT_EQ(S_OK, hr); | 734 ASSERT_EQ(S_OK, hr); |
| 732 EXPECT_STREQ(L"input", wstring(node_name, SysStringLen(node_name)).c_str()); | 735 EXPECT_STREQ(L"input", wstring(node_name, SysStringLen(node_name)).c_str()); |
| 733 EXPECT_EQ(NODETYPE_ELEMENT, node_type); | 736 EXPECT_EQ(NODETYPE_ELEMENT, node_type); |
| 734 EXPECT_EQ(0, num_children); | 737 EXPECT_EQ(0, num_children); |
| 735 } | 738 } |
| 736 } // namespace. | 739 } // namespace. |
| OLD | NEW |