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