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 <string> | 5 #include <string> |
6 #include <vector> | 6 #include <vector> |
7 | 7 |
8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
9 #include "chrome/browser/ui/browser.h" | 9 #include "chrome/browser/ui/browser.h" |
10 #include "chrome/test/base/in_process_browser_test.h" | 10 #include "chrome/test/base/in_process_browser_test.h" |
(...skipping 24 matching lines...) Expand all Loading... |
35 RendererAccessibilityBrowserTest() {} | 35 RendererAccessibilityBrowserTest() {} |
36 | 36 |
37 // Tell the renderer to send an accessibility tree, then wait for the | 37 // Tell the renderer to send an accessibility tree, then wait for the |
38 // notification that it's been received. | 38 // notification that it's been received. |
39 const AccessibilityNodeData& GetAccessibilityNodeDataTree( | 39 const AccessibilityNodeData& GetAccessibilityNodeDataTree( |
40 AccessibilityMode accessibility_mode = AccessibilityModeComplete) { | 40 AccessibilityMode accessibility_mode = AccessibilityModeComplete) { |
41 ui_test_utils::WindowedNotificationObserver tree_updated_observer( | 41 ui_test_utils::WindowedNotificationObserver tree_updated_observer( |
42 content::NOTIFICATION_RENDER_VIEW_HOST_ACCESSIBILITY_TREE_UPDATED, | 42 content::NOTIFICATION_RENDER_VIEW_HOST_ACCESSIBILITY_TREE_UPDATED, |
43 content::NotificationService::AllSources()); | 43 content::NotificationService::AllSources()); |
44 content::RenderWidgetHostView* host_view = | 44 content::RenderWidgetHostView* host_view = |
45 browser()->GetSelectedWebContents()->GetRenderWidgetHostView(); | 45 browser()->GetActiveWebContents()->GetRenderWidgetHostView(); |
46 RenderWidgetHostImpl* host = | 46 RenderWidgetHostImpl* host = |
47 RenderWidgetHostImpl::From(host_view->GetRenderWidgetHost()); | 47 RenderWidgetHostImpl::From(host_view->GetRenderWidgetHost()); |
48 RenderViewHostImpl* view_host = static_cast<RenderViewHostImpl*>(host); | 48 RenderViewHostImpl* view_host = static_cast<RenderViewHostImpl*>(host); |
49 view_host->set_save_accessibility_tree_for_testing(true); | 49 view_host->set_save_accessibility_tree_for_testing(true); |
50 view_host->SetAccessibilityMode(accessibility_mode); | 50 view_host->SetAccessibilityMode(accessibility_mode); |
51 tree_updated_observer.Wait(); | 51 tree_updated_observer.Wait(); |
52 return view_host->accessibility_tree_for_testing(); | 52 return view_host->accessibility_tree_for_testing(); |
53 } | 53 } |
54 | 54 |
55 // Make sure each node in the tree has an unique id. | 55 // Make sure each node in the tree has an unique id. |
(...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
522 | 522 |
523 const AccessibilityNodeData& text6 = tree.children[6]; | 523 const AccessibilityNodeData& text6 = tree.children[6]; |
524 EXPECT_EQ(AccessibilityNodeData::ROLE_TEXT_FIELD, text6.role); | 524 EXPECT_EQ(AccessibilityNodeData::ROLE_TEXT_FIELD, text6.role); |
525 EXPECT_STREQ("text6", UTF16ToUTF8(text6.value).c_str()); | 525 EXPECT_STREQ("text6", UTF16ToUTF8(text6.value).c_str()); |
526 | 526 |
527 const AccessibilityNodeData& text7 = tree.children[7]; | 527 const AccessibilityNodeData& text7 = tree.children[7]; |
528 EXPECT_EQ(AccessibilityNodeData::ROLE_GROUP, text7.role); | 528 EXPECT_EQ(AccessibilityNodeData::ROLE_GROUP, text7.role); |
529 } | 529 } |
530 | 530 |
531 } // namespace | 531 } // namespace |
OLD | NEW |