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 <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" |
11 #include "chrome/test/base/ui_test_utils.h" | 11 #include "chrome/test/base/ui_test_utils.h" |
12 #include "content/browser/renderer_host/render_view_host.h" | 12 #include "content/browser/renderer_host/render_view_host.h" |
13 #include "content/browser/renderer_host/render_widget_host.h" | 13 #include "content/browser/renderer_host/render_widget_host.h" |
14 #include "content/browser/renderer_host/render_widget_host_view.h" | 14 #include "content/browser/renderer_host/render_widget_host_view.h" |
15 #include "content/browser/tab_contents/tab_contents.h" | |
16 #include "content/public/browser/notification_service.h" | 15 #include "content/public/browser/notification_service.h" |
17 #include "content/public/browser/notification_types.h" | 16 #include "content/public/browser/notification_types.h" |
| 17 #include "content/public/browser/web_contents.h" |
18 | 18 |
19 #if defined(OS_WIN) | 19 #if defined(OS_WIN) |
20 #include <atlbase.h> | 20 #include <atlbase.h> |
21 #include <atlcom.h> | 21 #include <atlcom.h> |
22 #include "ui/base/win/atl_module.h" | 22 #include "ui/base/win/atl_module.h" |
23 #endif | 23 #endif |
24 | 24 |
25 using content::OpenURLParams; | 25 using content::OpenURLParams; |
26 using content::Referrer; | 26 using content::Referrer; |
27 using webkit_glue::WebAccessibility; | 27 using webkit_glue::WebAccessibility; |
28 | 28 |
29 namespace { | 29 namespace { |
30 | 30 |
31 class RendererAccessibilityBrowserTest : public InProcessBrowserTest { | 31 class RendererAccessibilityBrowserTest : public InProcessBrowserTest { |
32 public: | 32 public: |
33 RendererAccessibilityBrowserTest() {} | 33 RendererAccessibilityBrowserTest() {} |
34 | 34 |
35 // Tell the renderer to send an accessibility tree, then wait for the | 35 // Tell the renderer to send an accessibility tree, then wait for the |
36 // notification that it's been received. | 36 // notification that it's been received. |
37 const WebAccessibility& GetWebAccessibilityTree() { | 37 const WebAccessibility& GetWebAccessibilityTree() { |
38 ui_test_utils::WindowedNotificationObserver tree_updated_observer( | 38 ui_test_utils::WindowedNotificationObserver tree_updated_observer( |
39 content::NOTIFICATION_RENDER_VIEW_HOST_ACCESSIBILITY_TREE_UPDATED, | 39 content::NOTIFICATION_RENDER_VIEW_HOST_ACCESSIBILITY_TREE_UPDATED, |
40 content::NotificationService::AllSources()); | 40 content::NotificationService::AllSources()); |
41 RenderWidgetHostView* host_view = | 41 RenderWidgetHostView* host_view = |
42 browser()->GetSelectedTabContents()->GetRenderWidgetHostView(); | 42 browser()->GetSelectedWebContents()->GetRenderWidgetHostView(); |
43 RenderWidgetHost* host = host_view->GetRenderWidgetHost(); | 43 RenderWidgetHost* host = host_view->GetRenderWidgetHost(); |
44 RenderViewHost* view_host = static_cast<RenderViewHost*>(host); | 44 RenderViewHost* view_host = static_cast<RenderViewHost*>(host); |
45 view_host->set_save_accessibility_tree_for_testing(true); | 45 view_host->set_save_accessibility_tree_for_testing(true); |
46 view_host->EnableRendererAccessibility(); | 46 view_host->EnableRendererAccessibility(); |
47 tree_updated_observer.Wait(); | 47 tree_updated_observer.Wait(); |
48 return view_host->accessibility_tree_for_testing(); | 48 return view_host->accessibility_tree_for_testing(); |
49 } | 49 } |
50 | 50 |
51 // Make sure each node in the tree has an unique id. | 51 // Make sure each node in the tree has an unique id. |
52 void RecursiveAssertUniqueIds( | 52 void RecursiveAssertUniqueIds( |
(...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
455 const WebAccessibility& tree = GetWebAccessibilityTree(); | 455 const WebAccessibility& tree = GetWebAccessibilityTree(); |
456 | 456 |
457 ASSERT_EQ(1U, tree.children.size()); | 457 ASSERT_EQ(1U, tree.children.size()); |
458 const WebAccessibility& textbox = tree.children[0]; | 458 const WebAccessibility& textbox = tree.children[0]; |
459 | 459 |
460 EXPECT_EQ( | 460 EXPECT_EQ( |
461 true, GetBoolAttr(textbox, WebAccessibility::ATTR_CAN_SET_VALUE)); | 461 true, GetBoolAttr(textbox, WebAccessibility::ATTR_CAN_SET_VALUE)); |
462 } | 462 } |
463 | 463 |
464 } // namespace | 464 } // namespace |
OLD | NEW |