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 <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/stringprintf.h" | 9 #include "base/stringprintf.h" |
10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
213 GURL html_data_url(string("data:text/html,") + html); | 213 GURL html_data_url(string("data:text/html,") + html); |
214 ui_test_utils::NavigateToURL(browser(), html_data_url); | 214 ui_test_utils::NavigateToURL(browser(), html_data_url); |
215 | 215 |
216 // At this point, renderer accessibility is off and the page has completed | 216 // At this point, renderer accessibility is off and the page has completed |
217 // loading. (Both of these must be strictly true or there will be test | 217 // loading. (Both of these must be strictly true or there will be test |
218 // flakiness.) Now call GetRendererAccessible, which will trigger | 218 // flakiness.) Now call GetRendererAccessible, which will trigger |
219 // changing the accessibility mode to AccessibilityModeComplete. When | 219 // changing the accessibility mode to AccessibilityModeComplete. When |
220 // the renderer switches accessibility on, it will send a Layout Complete | 220 // the renderer switches accessibility on, it will send a Layout Complete |
221 // accessibility notification containing the full accessibility tree, which | 221 // accessibility notification containing the full accessibility tree, which |
222 // we can wait for. | 222 // we can wait for. |
223 content::WindowedNotificationObserver tree_updated_observer( | 223 scoped_refptr<MessageLoopRunner> loop_runner(new MessageLoopRunner); |
224 content::NOTIFICATION_ACCESSIBILITY_LAYOUT_COMPLETE, | 224 content::WebContents* web_contents = |
dmazzoni
2013/02/15 19:34:19
How about a helper method to get view_host since t
| |
225 content::NotificationService::AllSources()); | 225 browser()->tab_strip_model()->GetActiveWebContents(); |
226 content::RenderViewHost* view_host = web_contents->GetRenderViewHost(); | |
227 view_host->SetAccessibilityLayoutCompleteCallbackForTesting( | |
228 loop_runner->QuitClosure()); | |
226 GetRendererAccessible(); | 229 GetRendererAccessible(); |
227 tree_updated_observer.Wait(); | 230 loop_runner->Run(); |
228 } | 231 } |
229 | 232 |
230 // Retrieve the MSAA client accessibility object for the Render Widget Host View | 233 // Retrieve the MSAA client accessibility object for the Render Widget Host View |
231 // of the selected tab. | 234 // of the selected tab. |
232 IAccessible* | 235 IAccessible* |
233 AccessibilityWinBrowserTest::GetRendererAccessible() { | 236 AccessibilityWinBrowserTest::GetRendererAccessible() { |
234 HWND hwnd_render_widget_host_view = browser()->tab_strip_model()-> | 237 HWND hwnd_render_widget_host_view = browser()->tab_strip_model()-> |
235 GetActiveWebContents()->GetRenderWidgetHostView()->GetNativeView(); | 238 GetActiveWebContents()->GetRenderWidgetHostView()->GetNativeView(); |
236 | 239 |
237 // Invoke windows screen reader detection by sending the WM_GETOBJECT message | 240 // Invoke windows screen reader detection by sending the WM_GETOBJECT message |
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
484 IA2_ROLE_SECTION, L""); | 487 IA2_ROLE_SECTION, L""); |
485 radio_group_checker.SetExpectedState(STATE_SYSTEM_FOCUSABLE); | 488 radio_group_checker.SetExpectedState(STATE_SYSTEM_FOCUSABLE); |
486 AccessibleChecker document_checker(L"", ROLE_SYSTEM_DOCUMENT, L""); | 489 AccessibleChecker document_checker(L"", ROLE_SYSTEM_DOCUMENT, L""); |
487 list_item_checker.AppendExpectedChild(&list_marker_checker); | 490 list_item_checker.AppendExpectedChild(&list_marker_checker); |
488 list_item_checker.AppendExpectedChild(&static_text_checker); | 491 list_item_checker.AppendExpectedChild(&static_text_checker); |
489 radio_group_checker.AppendExpectedChild(&list_item_checker); | 492 radio_group_checker.AppendExpectedChild(&list_item_checker); |
490 document_checker.AppendExpectedChild(&radio_group_checker); | 493 document_checker.AppendExpectedChild(&radio_group_checker); |
491 document_checker.CheckAccessible(GetRendererAccessible()); | 494 document_checker.CheckAccessible(GetRendererAccessible()); |
492 | 495 |
493 // Set focus to the radio group. | 496 // Set focus to the radio group. |
494 content::WindowedNotificationObserver tree_updated_observer( | 497 scoped_refptr<MessageLoopRunner> loop_runner(new MessageLoopRunner); |
495 content::NOTIFICATION_ACCESSIBILITY_OTHER, | 498 content::WebContents* web_contents = |
496 content::NotificationService::AllSources()); | 499 browser()->tab_strip_model()->GetActiveWebContents(); |
500 content::RenderViewHost* view_host = web_contents->GetRenderViewHost(); | |
501 view_host->SetAccessibilityOtherCallbackForTesting( | |
502 loop_runner->QuitClosure()); | |
497 ExecuteScript(L"document.body.children[0].focus()"); | 503 ExecuteScript(L"document.body.children[0].focus()"); |
498 tree_updated_observer.Wait(); | 504 loop_runner->Run(); |
499 | 505 |
500 // Check that the accessibility tree of the browser has been updated. | 506 // Check that the accessibility tree of the browser has been updated. |
501 radio_group_checker.SetExpectedState( | 507 radio_group_checker.SetExpectedState( |
502 STATE_SYSTEM_FOCUSABLE | STATE_SYSTEM_FOCUSED); | 508 STATE_SYSTEM_FOCUSABLE | STATE_SYSTEM_FOCUSED); |
503 document_checker.CheckAccessible(GetRendererAccessible()); | 509 document_checker.CheckAccessible(GetRendererAccessible()); |
504 | 510 |
505 // Set the active descendant of the radio group | 511 // Set the active descendant of the radio group |
506 content::WindowedNotificationObserver tree_updated_observer3( | 512 loop_runner = new MessageLoopRunner; |
507 content::NOTIFICATION_ACCESSIBILITY_OTHER, | 513 view_host->SetAccessibilityOtherCallbackForTesting( |
508 content::NotificationService::AllSources()); | 514 loop_runner->QuitClosure()); |
509 ExecuteScript( | 515 ExecuteScript( |
510 L"document.body.children[0].setAttribute('aria-activedescendant', 'li')"); | 516 L"document.body.children[0].setAttribute('aria-activedescendant', 'li')"); |
511 tree_updated_observer3.Wait(); | 517 loop_runner->Run(); |
512 | 518 |
513 // Check that the accessibility tree of the browser has been updated. | 519 // Check that the accessibility tree of the browser has been updated. |
514 list_item_checker.SetExpectedState( | 520 list_item_checker.SetExpectedState( |
515 STATE_SYSTEM_READONLY | STATE_SYSTEM_FOCUSED); | 521 STATE_SYSTEM_READONLY | STATE_SYSTEM_FOCUSED); |
516 radio_group_checker.SetExpectedState(STATE_SYSTEM_FOCUSABLE); | 522 radio_group_checker.SetExpectedState(STATE_SYSTEM_FOCUSABLE); |
517 document_checker.CheckAccessible(GetRendererAccessible()); | 523 document_checker.CheckAccessible(GetRendererAccessible()); |
518 } | 524 } |
519 | 525 |
520 IN_PROC_BROWSER_TEST_F(AccessibilityWinBrowserTest, | 526 IN_PROC_BROWSER_TEST_F(AccessibilityWinBrowserTest, |
521 TestNotificationCheckedStateChanged) { | 527 TestNotificationCheckedStateChanged) { |
522 LoadInitialAccessibilityTreeFromHtml( | 528 LoadInitialAccessibilityTreeFromHtml( |
523 "<body><input type='checkbox' /></body>"); | 529 "<body><input type='checkbox' /></body>"); |
524 | 530 |
525 // Check the browser's copy of the renderer accessibility tree. | 531 // Check the browser's copy of the renderer accessibility tree. |
526 AccessibleChecker checkbox_checker(L"", ROLE_SYSTEM_CHECKBUTTON, L""); | 532 AccessibleChecker checkbox_checker(L"", ROLE_SYSTEM_CHECKBUTTON, L""); |
527 checkbox_checker.SetExpectedState(STATE_SYSTEM_FOCUSABLE); | 533 checkbox_checker.SetExpectedState(STATE_SYSTEM_FOCUSABLE); |
528 AccessibleChecker body_checker(L"", L"body", IA2_ROLE_SECTION, L""); | 534 AccessibleChecker body_checker(L"", L"body", IA2_ROLE_SECTION, L""); |
529 AccessibleChecker document_checker(L"", ROLE_SYSTEM_DOCUMENT, L""); | 535 AccessibleChecker document_checker(L"", ROLE_SYSTEM_DOCUMENT, L""); |
530 body_checker.AppendExpectedChild(&checkbox_checker); | 536 body_checker.AppendExpectedChild(&checkbox_checker); |
531 document_checker.AppendExpectedChild(&body_checker); | 537 document_checker.AppendExpectedChild(&body_checker); |
532 document_checker.CheckAccessible(GetRendererAccessible()); | 538 document_checker.CheckAccessible(GetRendererAccessible()); |
533 | 539 |
534 // Check the checkbox. | 540 // Check the checkbox. |
535 content::WindowedNotificationObserver tree_updated_observer( | 541 scoped_refptr<MessageLoopRunner> loop_runner(new MessageLoopRunner); |
536 content::NOTIFICATION_ACCESSIBILITY_OTHER, | 542 content::WebContents* web_contents = |
537 content::NotificationService::AllSources()); | 543 browser()->tab_strip_model()->GetActiveWebContents(); |
544 content::RenderViewHost* view_host = web_contents->GetRenderViewHost(); | |
545 view_host->SetAccessibilityOtherCallbackForTesting( | |
546 loop_runner->QuitClosure()); | |
538 ExecuteScript(L"document.body.children[0].checked=true"); | 547 ExecuteScript(L"document.body.children[0].checked=true"); |
539 tree_updated_observer.Wait(); | 548 loop_runner->Run(); |
540 | 549 |
541 // Check that the accessibility tree of the browser has been updated. | 550 // Check that the accessibility tree of the browser has been updated. |
542 checkbox_checker.SetExpectedState( | 551 checkbox_checker.SetExpectedState( |
543 STATE_SYSTEM_CHECKED | STATE_SYSTEM_FOCUSABLE); | 552 STATE_SYSTEM_CHECKED | STATE_SYSTEM_FOCUSABLE); |
544 document_checker.CheckAccessible(GetRendererAccessible()); | 553 document_checker.CheckAccessible(GetRendererAccessible()); |
545 } | 554 } |
546 | 555 |
547 IN_PROC_BROWSER_TEST_F(AccessibilityWinBrowserTest, | 556 IN_PROC_BROWSER_TEST_F(AccessibilityWinBrowserTest, |
548 TestNotificationChildrenChanged) { | 557 TestNotificationChildrenChanged) { |
549 // The role attribute causes the node to be in the accessibility tree. | 558 // The role attribute causes the node to be in the accessibility tree. |
550 LoadInitialAccessibilityTreeFromHtml("<body role=group></body>"); | 559 LoadInitialAccessibilityTreeFromHtml("<body role=group></body>"); |
551 | 560 |
552 // Check the browser's copy of the renderer accessibility tree. | 561 // Check the browser's copy of the renderer accessibility tree. |
553 AccessibleChecker group_checker(L"", ROLE_SYSTEM_GROUPING, L""); | 562 AccessibleChecker group_checker(L"", ROLE_SYSTEM_GROUPING, L""); |
554 AccessibleChecker document_checker(L"", ROLE_SYSTEM_DOCUMENT, L""); | 563 AccessibleChecker document_checker(L"", ROLE_SYSTEM_DOCUMENT, L""); |
555 document_checker.AppendExpectedChild(&group_checker); | 564 document_checker.AppendExpectedChild(&group_checker); |
556 document_checker.CheckAccessible(GetRendererAccessible()); | 565 document_checker.CheckAccessible(GetRendererAccessible()); |
557 | 566 |
558 // Change the children of the document body. | 567 // Change the children of the document body. |
559 content::WindowedNotificationObserver tree_updated_observer( | 568 scoped_refptr<MessageLoopRunner> loop_runner(new MessageLoopRunner); |
560 content::NOTIFICATION_ACCESSIBILITY_OTHER, | 569 content::WebContents* web_contents = |
561 content::NotificationService::AllSources()); | 570 browser()->tab_strip_model()->GetActiveWebContents(); |
571 content::RenderViewHost* view_host = web_contents->GetRenderViewHost(); | |
572 view_host->SetAccessibilityOtherCallbackForTesting( | |
573 loop_runner->QuitClosure()); | |
562 ExecuteScript(L"document.body.innerHTML='<b>new text</b>'"); | 574 ExecuteScript(L"document.body.innerHTML='<b>new text</b>'"); |
563 tree_updated_observer.Wait(); | 575 loop_runner->Run(); |
564 | 576 |
565 // Check that the accessibility tree of the browser has been updated. | 577 // Check that the accessibility tree of the browser has been updated. |
566 AccessibleChecker text_checker(L"new text", ROLE_SYSTEM_TEXT, L""); | 578 AccessibleChecker text_checker(L"new text", ROLE_SYSTEM_TEXT, L""); |
567 group_checker.AppendExpectedChild(&text_checker); | 579 group_checker.AppendExpectedChild(&text_checker); |
568 document_checker.CheckAccessible(GetRendererAccessible()); | 580 document_checker.CheckAccessible(GetRendererAccessible()); |
569 } | 581 } |
570 | 582 |
571 IN_PROC_BROWSER_TEST_F(AccessibilityWinBrowserTest, | 583 IN_PROC_BROWSER_TEST_F(AccessibilityWinBrowserTest, |
572 TestNotificationChildrenChanged2) { | 584 TestNotificationChildrenChanged2) { |
573 // The role attribute causes the node to be in the accessibility tree. | 585 // The role attribute causes the node to be in the accessibility tree. |
574 LoadInitialAccessibilityTreeFromHtml( | 586 LoadInitialAccessibilityTreeFromHtml( |
575 "<div role=group style='visibility: hidden'>text</div>"); | 587 "<div role=group style='visibility: hidden'>text</div>"); |
576 | 588 |
577 // Check the accessible tree of the browser. | 589 // Check the accessible tree of the browser. |
578 AccessibleChecker document_checker(L"", ROLE_SYSTEM_DOCUMENT, L""); | 590 AccessibleChecker document_checker(L"", ROLE_SYSTEM_DOCUMENT, L""); |
579 document_checker.CheckAccessible(GetRendererAccessible()); | 591 document_checker.CheckAccessible(GetRendererAccessible()); |
580 | 592 |
581 // Change the children of the document body. | 593 // Change the children of the document body. |
582 content::WindowedNotificationObserver tree_updated_observer2( | 594 scoped_refptr<MessageLoopRunner> loop_runner(new MessageLoopRunner); |
583 content::NOTIFICATION_ACCESSIBILITY_OTHER, | 595 content::WebContents* web_contents = |
584 content::NotificationService::AllSources()); | 596 browser()->tab_strip_model()->GetActiveWebContents(); |
597 content::RenderViewHost* view_host = web_contents->GetRenderViewHost(); | |
598 view_host->SetAccessibilityOtherCallbackForTesting( | |
599 loop_runner->QuitClosure()); | |
585 ExecuteScript(L"document.body.children[0].style.visibility='visible'"); | 600 ExecuteScript(L"document.body.children[0].style.visibility='visible'"); |
586 tree_updated_observer2.Wait(); | 601 loop_runner->Run(); |
587 | 602 |
588 // Check that the accessibility tree of the browser has been updated. | 603 // Check that the accessibility tree of the browser has been updated. |
589 AccessibleChecker static_text_checker(L"text", ROLE_SYSTEM_TEXT, L""); | 604 AccessibleChecker static_text_checker(L"text", ROLE_SYSTEM_TEXT, L""); |
590 AccessibleChecker group_checker(L"", ROLE_SYSTEM_GROUPING, L""); | 605 AccessibleChecker group_checker(L"", ROLE_SYSTEM_GROUPING, L""); |
591 document_checker.AppendExpectedChild(&group_checker); | 606 document_checker.AppendExpectedChild(&group_checker); |
592 group_checker.AppendExpectedChild(&static_text_checker); | 607 group_checker.AppendExpectedChild(&static_text_checker); |
593 document_checker.CheckAccessible(GetRendererAccessible()); | 608 document_checker.CheckAccessible(GetRendererAccessible()); |
594 } | 609 } |
595 | 610 |
596 IN_PROC_BROWSER_TEST_F(AccessibilityWinBrowserTest, | 611 IN_PROC_BROWSER_TEST_F(AccessibilityWinBrowserTest, |
597 TestNotificationFocusChanged) { | 612 TestNotificationFocusChanged) { |
598 // The role attribute causes the node to be in the accessibility tree. | 613 // The role attribute causes the node to be in the accessibility tree. |
599 LoadInitialAccessibilityTreeFromHtml("<div role=group tabindex='-1'></div>"); | 614 LoadInitialAccessibilityTreeFromHtml("<div role=group tabindex='-1'></div>"); |
600 | 615 |
601 // Check the browser's copy of the renderer accessibility tree. | 616 // Check the browser's copy of the renderer accessibility tree. |
602 SCOPED_TRACE("Check initial tree"); | 617 SCOPED_TRACE("Check initial tree"); |
603 AccessibleChecker group_checker(L"", ROLE_SYSTEM_GROUPING, L""); | 618 AccessibleChecker group_checker(L"", ROLE_SYSTEM_GROUPING, L""); |
604 group_checker.SetExpectedState( | 619 group_checker.SetExpectedState( |
605 STATE_SYSTEM_FOCUSABLE | STATE_SYSTEM_OFFSCREEN); | 620 STATE_SYSTEM_FOCUSABLE | STATE_SYSTEM_OFFSCREEN); |
606 AccessibleChecker document_checker(L"", ROLE_SYSTEM_DOCUMENT, L""); | 621 AccessibleChecker document_checker(L"", ROLE_SYSTEM_DOCUMENT, L""); |
607 document_checker.AppendExpectedChild(&group_checker); | 622 document_checker.AppendExpectedChild(&group_checker); |
608 document_checker.CheckAccessible(GetRendererAccessible()); | 623 document_checker.CheckAccessible(GetRendererAccessible()); |
609 | 624 |
610 // Focus the div in the document | 625 // Focus the div in the document |
611 content::WindowedNotificationObserver tree_updated_observer( | 626 scoped_refptr<MessageLoopRunner> loop_runner(new MessageLoopRunner); |
612 content::NOTIFICATION_ACCESSIBILITY_OTHER, | 627 content::WebContents* web_contents = |
613 content::NotificationService::AllSources()); | 628 browser()->tab_strip_model()->GetActiveWebContents(); |
614 ExecuteScript(L"document.body.children[0].focus()"); | 629 content::RenderViewHost* view_host = web_contents->GetRenderViewHost(); |
615 tree_updated_observer.Wait(); | 630 view_host->SetAccessibilityOtherCallbackForTesting( |
631 loop_runner->QuitClosure()); | |
632 loop_runner->Run(); | |
616 | 633 |
617 // Check that the accessibility tree of the browser has been updated. | 634 // Check that the accessibility tree of the browser has been updated. |
618 SCOPED_TRACE("Check updated tree after focusing div"); | 635 SCOPED_TRACE("Check updated tree after focusing div"); |
619 group_checker.SetExpectedState( | 636 group_checker.SetExpectedState( |
620 STATE_SYSTEM_FOCUSABLE | STATE_SYSTEM_FOCUSED); | 637 STATE_SYSTEM_FOCUSABLE | STATE_SYSTEM_FOCUSED); |
621 document_checker.CheckAccessible(GetRendererAccessible()); | 638 document_checker.CheckAccessible(GetRendererAccessible()); |
622 | 639 |
623 // Focus the document accessible. This will un-focus the current node. | 640 // Focus the document accessible. This will un-focus the current node. |
624 content::WindowedNotificationObserver tree_updated_observer2( | 641 loop_runner = new MessageLoopRunner; |
625 content::NOTIFICATION_ACCESSIBILITY_OTHER, | 642 view_host->SetAccessibilityOtherCallbackForTesting( |
626 content::NotificationService::AllSources()); | 643 loop_runner->QuitClosure()); |
627 base::win::ScopedComPtr<IAccessible> document_accessible( | 644 base::win::ScopedComPtr<IAccessible> document_accessible( |
628 GetRendererAccessible()); | 645 GetRendererAccessible()); |
629 ASSERT_NE(document_accessible.get(), reinterpret_cast<IAccessible*>(NULL)); | 646 ASSERT_NE(document_accessible.get(), reinterpret_cast<IAccessible*>(NULL)); |
630 HRESULT hr = document_accessible->accSelect( | 647 HRESULT hr = document_accessible->accSelect( |
631 SELFLAG_TAKEFOCUS, CreateI4Variant(CHILDID_SELF)); | 648 SELFLAG_TAKEFOCUS, CreateI4Variant(CHILDID_SELF)); |
632 ASSERT_EQ(S_OK, hr); | 649 ASSERT_EQ(S_OK, hr); |
633 tree_updated_observer2.Wait(); | 650 loop_runner->Run(); |
634 | 651 |
635 // Check that the accessibility tree of the browser has been updated. | 652 // Check that the accessibility tree of the browser has been updated. |
636 SCOPED_TRACE("Check updated tree after focusing document again"); | 653 SCOPED_TRACE("Check updated tree after focusing document again"); |
637 group_checker.SetExpectedState(STATE_SYSTEM_FOCUSABLE); | 654 group_checker.SetExpectedState(STATE_SYSTEM_FOCUSABLE); |
638 document_checker.CheckAccessible(GetRendererAccessible()); | 655 document_checker.CheckAccessible(GetRendererAccessible()); |
639 } | 656 } |
640 | 657 |
641 IN_PROC_BROWSER_TEST_F(AccessibilityWinBrowserTest, | 658 IN_PROC_BROWSER_TEST_F(AccessibilityWinBrowserTest, |
642 TestNotificationValueChanged) { | 659 TestNotificationValueChanged) { |
643 LoadInitialAccessibilityTreeFromHtml( | 660 LoadInitialAccessibilityTreeFromHtml( |
644 "<body><input type='text' value='old value'/></body>"); | 661 "<body><input type='text' value='old value'/></body>"); |
645 | 662 |
646 // Check the browser's copy of the renderer accessibility tree. | 663 // Check the browser's copy of the renderer accessibility tree. |
647 AccessibleChecker text_field_checker(L"", ROLE_SYSTEM_TEXT, L"old value"); | 664 AccessibleChecker text_field_checker(L"", ROLE_SYSTEM_TEXT, L"old value"); |
648 text_field_checker.SetExpectedState(STATE_SYSTEM_FOCUSABLE); | 665 text_field_checker.SetExpectedState(STATE_SYSTEM_FOCUSABLE); |
649 AccessibleChecker body_checker(L"", L"body", IA2_ROLE_SECTION, L""); | 666 AccessibleChecker body_checker(L"", L"body", IA2_ROLE_SECTION, L""); |
650 AccessibleChecker document_checker(L"", ROLE_SYSTEM_DOCUMENT, L""); | 667 AccessibleChecker document_checker(L"", ROLE_SYSTEM_DOCUMENT, L""); |
651 body_checker.AppendExpectedChild(&text_field_checker); | 668 body_checker.AppendExpectedChild(&text_field_checker); |
652 document_checker.AppendExpectedChild(&body_checker); | 669 document_checker.AppendExpectedChild(&body_checker); |
653 document_checker.CheckAccessible(GetRendererAccessible()); | 670 document_checker.CheckAccessible(GetRendererAccessible()); |
654 | 671 |
655 // Set the value of the text control | 672 // Set the value of the text control |
656 content::WindowedNotificationObserver tree_updated_observer( | 673 scoped_refptr<MessageLoopRunner> loop_runner(new MessageLoopRunner); |
657 content::NOTIFICATION_ACCESSIBILITY_OTHER, | 674 content::WebContents* web_contents = |
658 content::NotificationService::AllSources()); | 675 browser()->tab_strip_model()->GetActiveWebContents(); |
676 content::RenderViewHost* view_host = web_contents->GetRenderViewHost(); | |
677 view_host->SetAccessibilityOtherCallbackForTesting( | |
678 loop_runner->QuitClosure()); | |
659 ExecuteScript(L"document.body.children[0].value='new value'"); | 679 ExecuteScript(L"document.body.children[0].value='new value'"); |
660 tree_updated_observer.Wait(); | 680 loop_runner->Run(); |
661 | 681 |
662 // Check that the accessibility tree of the browser has been updated. | 682 // Check that the accessibility tree of the browser has been updated. |
663 text_field_checker.SetExpectedValue(L"new value"); | 683 text_field_checker.SetExpectedValue(L"new value"); |
664 document_checker.CheckAccessible(GetRendererAccessible()); | 684 document_checker.CheckAccessible(GetRendererAccessible()); |
665 } | 685 } |
666 | 686 |
667 // This test verifies that the web content's accessibility tree is a | 687 // This test verifies that the web content's accessibility tree is a |
668 // descendant of the main browser window's accessibility tree, so that | 688 // descendant of the main browser window's accessibility tree, so that |
669 // tools like AccExplorer32 or AccProbe can be used to examine Chrome's | 689 // tools like AccExplorer32 or AccProbe can be used to examine Chrome's |
670 // accessibility support. | 690 // accessibility support. |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
834 | 854 |
835 // Check the browser's copy of the renderer accessibility tree. | 855 // Check the browser's copy of the renderer accessibility tree. |
836 AccessibleChecker grouping1_checker(L"", ROLE_SYSTEM_GROUPING, L""); | 856 AccessibleChecker grouping1_checker(L"", ROLE_SYSTEM_GROUPING, L""); |
837 AccessibleChecker grouping2_checker(L"", ROLE_SYSTEM_GROUPING, L""); | 857 AccessibleChecker grouping2_checker(L"", ROLE_SYSTEM_GROUPING, L""); |
838 AccessibleChecker document_checker(L"", ROLE_SYSTEM_DOCUMENT, L""); | 858 AccessibleChecker document_checker(L"", ROLE_SYSTEM_DOCUMENT, L""); |
839 document_checker.AppendExpectedChild(&grouping1_checker); | 859 document_checker.AppendExpectedChild(&grouping1_checker); |
840 document_checker.AppendExpectedChild(&grouping2_checker); | 860 document_checker.AppendExpectedChild(&grouping2_checker); |
841 document_checker.CheckAccessible(GetRendererAccessible()); | 861 document_checker.CheckAccessible(GetRendererAccessible()); |
842 } | 862 } |
843 } // namespace. | 863 } // namespace. |
OLD | NEW |