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 tree_updated_observer.Wait(); | 45 while (view_host->accessibility_tree_for_testing().state & |
| 46 (1 << WebAccessibility::STATE_BUSY)) { |
| 47 tree_updated_observer.Wait(); |
| 48 } |
46 return view_host->accessibility_tree_for_testing(); | 49 return view_host->accessibility_tree_for_testing(); |
47 } | 50 } |
48 | 51 |
49 // Make sure each node in the tree has an unique id. | 52 // Make sure each node in the tree has an unique id. |
50 void RecursiveAssertUniqueIds( | 53 void RecursiveAssertUniqueIds( |
51 const WebAccessibility& node, base::hash_set<int>* ids) { | 54 const WebAccessibility& node, base::hash_set<int>* ids) { |
52 ASSERT_TRUE(ids->find(node.id) == ids->end()); | 55 ASSERT_TRUE(ids->find(node.id) == ids->end()); |
53 ids->insert(node.id); | 56 ids->insert(node.id); |
54 for (size_t i = 0; i < node.children.size(); i++) | 57 for (size_t i = 0; i < node.children.size(); i++) |
55 RecursiveAssertUniqueIds(node.children[i], ids); | 58 RecursiveAssertUniqueIds(node.children[i], ids); |
(...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
443 const WebAccessibility& tree = GetWebAccessibilityTree(); | 446 const WebAccessibility& tree = GetWebAccessibilityTree(); |
444 | 447 |
445 ASSERT_EQ(1U, tree.children.size()); | 448 ASSERT_EQ(1U, tree.children.size()); |
446 const WebAccessibility& textbox = tree.children[0]; | 449 const WebAccessibility& textbox = tree.children[0]; |
447 | 450 |
448 EXPECT_EQ( | 451 EXPECT_EQ( |
449 true, GetBoolAttr(textbox, WebAccessibility::ATTR_CAN_SET_VALUE)); | 452 true, GetBoolAttr(textbox, WebAccessibility::ATTR_CAN_SET_VALUE)); |
450 } | 453 } |
451 | 454 |
452 } // namespace | 455 } // namespace |
OLD | NEW |