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/browser/ui/browser_tabstrip.h" |
10 #include "chrome/test/base/in_process_browser_test.h" | 11 #include "chrome/test/base/in_process_browser_test.h" |
11 #include "chrome/test/base/ui_test_utils.h" | 12 #include "chrome/test/base/ui_test_utils.h" |
12 #include "content/browser/renderer_host/render_view_host_impl.h" | 13 #include "content/browser/renderer_host/render_view_host_impl.h" |
13 #include "content/common/accessibility_node_data.h" | 14 #include "content/common/accessibility_node_data.h" |
14 #include "content/public/browser/notification_service.h" | 15 #include "content/public/browser/notification_service.h" |
15 #include "content/public/browser/notification_types.h" | 16 #include "content/public/browser/notification_types.h" |
16 #include "content/public/browser/render_widget_host_view.h" | 17 #include "content/public/browser/render_widget_host_view.h" |
17 #include "content/public/browser/web_contents.h" | 18 #include "content/public/browser/web_contents.h" |
18 | 19 |
19 #if defined(OS_WIN) | 20 #if defined(OS_WIN) |
(...skipping 15 matching lines...) Expand all Loading... |
35 RendererAccessibilityBrowserTest() {} | 36 RendererAccessibilityBrowserTest() {} |
36 | 37 |
37 // Tell the renderer to send an accessibility tree, then wait for the | 38 // Tell the renderer to send an accessibility tree, then wait for the |
38 // notification that it's been received. | 39 // notification that it's been received. |
39 const AccessibilityNodeData& GetAccessibilityNodeDataTree( | 40 const AccessibilityNodeData& GetAccessibilityNodeDataTree( |
40 AccessibilityMode accessibility_mode = AccessibilityModeComplete) { | 41 AccessibilityMode accessibility_mode = AccessibilityModeComplete) { |
41 ui_test_utils::WindowedNotificationObserver tree_updated_observer( | 42 ui_test_utils::WindowedNotificationObserver tree_updated_observer( |
42 content::NOTIFICATION_RENDER_VIEW_HOST_ACCESSIBILITY_TREE_UPDATED, | 43 content::NOTIFICATION_RENDER_VIEW_HOST_ACCESSIBILITY_TREE_UPDATED, |
43 content::NotificationService::AllSources()); | 44 content::NotificationService::AllSources()); |
44 content::RenderWidgetHostView* host_view = | 45 content::RenderWidgetHostView* host_view = |
45 browser()->GetActiveWebContents()->GetRenderWidgetHostView(); | 46 chrome::GetActiveWebContents(browser())->GetRenderWidgetHostView(); |
46 RenderWidgetHostImpl* host = | 47 RenderWidgetHostImpl* host = |
47 RenderWidgetHostImpl::From(host_view->GetRenderWidgetHost()); | 48 RenderWidgetHostImpl::From(host_view->GetRenderWidgetHost()); |
48 RenderViewHostImpl* view_host = static_cast<RenderViewHostImpl*>(host); | 49 RenderViewHostImpl* view_host = static_cast<RenderViewHostImpl*>(host); |
49 view_host->set_save_accessibility_tree_for_testing(true); | 50 view_host->set_save_accessibility_tree_for_testing(true); |
50 view_host->SetAccessibilityMode(accessibility_mode); | 51 view_host->SetAccessibilityMode(accessibility_mode); |
51 tree_updated_observer.Wait(); | 52 tree_updated_observer.Wait(); |
52 return view_host->accessibility_tree_for_testing(); | 53 return view_host->accessibility_tree_for_testing(); |
53 } | 54 } |
54 | 55 |
55 // Make sure each node in the tree has an unique id. | 56 // 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 | 523 |
523 const AccessibilityNodeData& text6 = tree.children[6]; | 524 const AccessibilityNodeData& text6 = tree.children[6]; |
524 EXPECT_EQ(AccessibilityNodeData::ROLE_TEXT_FIELD, text6.role); | 525 EXPECT_EQ(AccessibilityNodeData::ROLE_TEXT_FIELD, text6.role); |
525 EXPECT_STREQ("text6", UTF16ToUTF8(text6.value).c_str()); | 526 EXPECT_STREQ("text6", UTF16ToUTF8(text6.value).c_str()); |
526 | 527 |
527 const AccessibilityNodeData& text7 = tree.children[7]; | 528 const AccessibilityNodeData& text7 = tree.children[7]; |
528 EXPECT_EQ(AccessibilityNodeData::ROLE_GROUP, text7.role); | 529 EXPECT_EQ(AccessibilityNodeData::ROLE_GROUP, text7.role); |
529 } | 530 } |
530 | 531 |
531 } // namespace | 532 } // namespace |
OLD | NEW |