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 22 matching lines...) Expand all Loading... |
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 content::RenderWidgetHostView* host_view = | 41 content::RenderWidgetHostView* host_view = |
42 browser()->GetSelectedWebContents()->GetRenderWidgetHostView(); | 42 browser()->GetSelectedWebContents()->GetRenderWidgetHostView(); |
43 RenderWidgetHostImpl* host = static_cast<RenderWidgetHostImpl*>( | 43 RenderWidgetHostImpl* host = |
44 host_view->GetRenderWidgetHost()); | 44 RenderWidgetHostImpl::From(host_view->GetRenderWidgetHost()); |
45 RenderViewHost* view_host = static_cast<RenderViewHost*>(host); | 45 RenderViewHostImpl* view_host = static_cast<RenderViewHostImpl*>(host); |
46 view_host->set_save_accessibility_tree_for_testing(true); | 46 view_host->set_save_accessibility_tree_for_testing(true); |
47 view_host->EnableRendererAccessibility(); | 47 view_host->EnableRendererAccessibility(); |
48 tree_updated_observer.Wait(); | 48 tree_updated_observer.Wait(); |
49 return view_host->accessibility_tree_for_testing(); | 49 return view_host->accessibility_tree_for_testing(); |
50 } | 50 } |
51 | 51 |
52 // Make sure each node in the tree has an unique id. | 52 // Make sure each node in the tree has an unique id. |
53 void RecursiveAssertUniqueIds( | 53 void RecursiveAssertUniqueIds( |
54 const WebAccessibility& node, base::hash_set<int>* ids) { | 54 const WebAccessibility& node, base::hash_set<int>* ids) { |
55 ASSERT_TRUE(ids->find(node.id) == ids->end()); | 55 ASSERT_TRUE(ids->find(node.id) == ids->end()); |
(...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
456 const WebAccessibility& tree = GetWebAccessibilityTree(); | 456 const WebAccessibility& tree = GetWebAccessibilityTree(); |
457 | 457 |
458 ASSERT_EQ(1U, tree.children.size()); | 458 ASSERT_EQ(1U, tree.children.size()); |
459 const WebAccessibility& textbox = tree.children[0]; | 459 const WebAccessibility& textbox = tree.children[0]; |
460 | 460 |
461 EXPECT_EQ( | 461 EXPECT_EQ( |
462 true, GetBoolAttr(textbox, WebAccessibility::ATTR_CAN_SET_VALUE)); | 462 true, GetBoolAttr(textbox, WebAccessibility::ATTR_CAN_SET_VALUE)); |
463 } | 463 } |
464 | 464 |
465 } // namespace | 465 } // namespace |
OLD | NEW |