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/public/browser/notification_service.h" | 14 #include "content/public/browser/notification_service.h" |
14 #include "content/public/browser/notification_types.h" | 15 #include "content/public/browser/notification_types.h" |
15 #include "content/public/browser/render_widget_host_view.h" | 16 #include "content/public/browser/render_widget_host_view.h" |
16 #include "content/public/browser/web_contents.h" | 17 #include "content/public/browser/web_contents.h" |
17 | 18 |
18 #if defined(OS_WIN) | 19 #if defined(OS_WIN) |
19 #include <atlbase.h> | 20 #include <atlbase.h> |
(...skipping 14 matching lines...) Expand all Loading... |
34 CrossPlatformAccessibilityBrowserTest() {} | 35 CrossPlatformAccessibilityBrowserTest() {} |
35 | 36 |
36 // 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 |
37 // notification that it's been received. | 38 // notification that it's been received. |
38 const AccessibilityNodeData& GetAccessibilityNodeDataTree( | 39 const AccessibilityNodeData& GetAccessibilityNodeDataTree( |
39 AccessibilityMode accessibility_mode = AccessibilityModeComplete) { | 40 AccessibilityMode accessibility_mode = AccessibilityModeComplete) { |
40 ui_test_utils::WindowedNotificationObserver tree_updated_observer( | 41 ui_test_utils::WindowedNotificationObserver tree_updated_observer( |
41 content::NOTIFICATION_RENDER_VIEW_HOST_ACCESSIBILITY_TREE_UPDATED, | 42 content::NOTIFICATION_RENDER_VIEW_HOST_ACCESSIBILITY_TREE_UPDATED, |
42 content::NotificationService::AllSources()); | 43 content::NotificationService::AllSources()); |
43 content::RenderWidgetHostView* host_view = | 44 content::RenderWidgetHostView* host_view = |
44 browser()->GetActiveWebContents()->GetRenderWidgetHostView(); | 45 chrome::GetActiveWebContents(browser())->GetRenderWidgetHostView(); |
45 RenderWidgetHostImpl* host = | 46 RenderWidgetHostImpl* host = |
46 RenderWidgetHostImpl::From(host_view->GetRenderWidgetHost()); | 47 RenderWidgetHostImpl::From(host_view->GetRenderWidgetHost()); |
47 RenderViewHostImpl* view_host = static_cast<RenderViewHostImpl*>(host); | 48 RenderViewHostImpl* view_host = static_cast<RenderViewHostImpl*>(host); |
48 view_host->set_save_accessibility_tree_for_testing(true); | 49 view_host->set_save_accessibility_tree_for_testing(true); |
49 view_host->SetAccessibilityMode(accessibility_mode); | 50 view_host->SetAccessibilityMode(accessibility_mode); |
50 tree_updated_observer.Wait(); | 51 tree_updated_observer.Wait(); |
51 return view_host->accessibility_tree_for_testing(); | 52 return view_host->accessibility_tree_for_testing(); |
52 } | 53 } |
53 | 54 |
54 // Make sure each node in the tree has an unique id. | 55 // Make sure each node in the tree has an unique id. |
(...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
464 const AccessibilityNodeData& tree = GetAccessibilityNodeDataTree(); | 465 const AccessibilityNodeData& tree = GetAccessibilityNodeDataTree(); |
465 | 466 |
466 ASSERT_EQ(1U, tree.children.size()); | 467 ASSERT_EQ(1U, tree.children.size()); |
467 const AccessibilityNodeData& textbox = tree.children[0]; | 468 const AccessibilityNodeData& textbox = tree.children[0]; |
468 | 469 |
469 EXPECT_EQ( | 470 EXPECT_EQ( |
470 true, GetBoolAttr(textbox, AccessibilityNodeData::ATTR_CAN_SET_VALUE)); | 471 true, GetBoolAttr(textbox, AccessibilityNodeData::ATTR_CAN_SET_VALUE)); |
471 } | 472 } |
472 | 473 |
473 } // namespace | 474 } // namespace |
OLD | NEW |