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" |
(...skipping 24 matching lines...) Expand all Loading... |
35 const WebAccessibility& GetWebAccessibilityTree() { | 35 const WebAccessibility& GetWebAccessibilityTree() { |
36 ui_test_utils::WindowedNotificationObserver tree_updated_observer( | 36 ui_test_utils::WindowedNotificationObserver tree_updated_observer( |
37 content::NOTIFICATION_RENDER_VIEW_HOST_ACCESSIBILITY_TREE_UPDATED, | 37 content::NOTIFICATION_RENDER_VIEW_HOST_ACCESSIBILITY_TREE_UPDATED, |
38 content::NotificationService::AllSources()); | 38 content::NotificationService::AllSources()); |
39 RenderWidgetHostView* host_view = | 39 RenderWidgetHostView* host_view = |
40 browser()->GetSelectedTabContents()->GetRenderWidgetHostView(); | 40 browser()->GetSelectedTabContents()->GetRenderWidgetHostView(); |
41 RenderWidgetHost* host = host_view->GetRenderWidgetHost(); | 41 RenderWidgetHost* host = host_view->GetRenderWidgetHost(); |
42 RenderViewHost* view_host = static_cast<RenderViewHost*>(host); | 42 RenderViewHost* view_host = static_cast<RenderViewHost*>(host); |
43 view_host->set_save_accessibility_tree_for_testing(true); | 43 view_host->set_save_accessibility_tree_for_testing(true); |
44 view_host->EnableRendererAccessibility(); | 44 view_host->EnableRendererAccessibility(); |
45 while (view_host->accessibility_tree_for_testing().state & | 45 tree_updated_observer.Wait(); |
46 (1 << WebAccessibility::STATE_BUSY)) { | |
47 tree_updated_observer.Wait(); | |
48 } | |
49 return view_host->accessibility_tree_for_testing(); | 46 return view_host->accessibility_tree_for_testing(); |
50 } | 47 } |
51 | 48 |
52 // Make sure each node in the tree has an unique id. | 49 // Make sure each node in the tree has an unique id. |
53 void RecursiveAssertUniqueIds( | 50 void RecursiveAssertUniqueIds( |
54 const WebAccessibility& node, base::hash_set<int>* ids) { | 51 const WebAccessibility& node, base::hash_set<int>* ids) { |
55 ASSERT_TRUE(ids->find(node.id) == ids->end()); | 52 ASSERT_TRUE(ids->find(node.id) == ids->end()); |
56 ids->insert(node.id); | 53 ids->insert(node.id); |
57 for (size_t i = 0; i < node.children.size(); i++) | 54 for (size_t i = 0; i < node.children.size(); i++) |
58 RecursiveAssertUniqueIds(node.children[i], ids); | 55 RecursiveAssertUniqueIds(node.children[i], ids); |
(...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
446 const WebAccessibility& tree = GetWebAccessibilityTree(); | 443 const WebAccessibility& tree = GetWebAccessibilityTree(); |
447 | 444 |
448 ASSERT_EQ(1U, tree.children.size()); | 445 ASSERT_EQ(1U, tree.children.size()); |
449 const WebAccessibility& textbox = tree.children[0]; | 446 const WebAccessibility& textbox = tree.children[0]; |
450 | 447 |
451 EXPECT_EQ( | 448 EXPECT_EQ( |
452 true, GetBoolAttr(textbox, WebAccessibility::ATTR_CAN_SET_VALUE)); | 449 true, GetBoolAttr(textbox, WebAccessibility::ATTR_CAN_SET_VALUE)); |
453 } | 450 } |
454 | 451 |
455 } // namespace | 452 } // namespace |
OLD | NEW |