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/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
9 #include "content/browser/renderer_host/render_view_host_impl.h" | 9 #include "content/browser/renderer_host/render_view_host_impl.h" |
10 #include "content/public/browser/notification_service.h" | 10 #include "content/public/browser/notification_service.h" |
11 #include "content/public/browser/notification_types.h" | 11 #include "content/public/browser/notification_types.h" |
12 #include "content/public/browser/render_widget_host_view.h" | 12 #include "content/public/browser/render_widget_host_view.h" |
13 #include "content/shell/browser/shell.h" | 13 #include "content/shell/browser/shell.h" |
14 #include "content/test/accessibility_browser_test_utils.h" | 14 #include "content/test/accessibility_browser_test_utils.h" |
15 #include "content/test/content_browser_test.h" | 15 #include "content/test/content_browser_test.h" |
16 #include "content/test/content_browser_test_utils.h" | 16 #include "content/test/content_browser_test_utils.h" |
17 #include "ui/accessibility/ax_node.h" | 17 #include "ui/accessibility/ax_node.h" |
| 18 #include "ui/accessibility/ax_tree.h" |
18 | 19 |
19 #if defined(OS_WIN) | 20 #if defined(OS_WIN) |
20 #include <atlbase.h> | 21 #include <atlbase.h> |
21 #include <atlcom.h> | 22 #include <atlcom.h> |
22 #include "base/win/scoped_com_initializer.h" | 23 #include "base/win/scoped_com_initializer.h" |
23 #include "ui/base/win/atl_module.h" | 24 #include "ui/base/win/atl_module.h" |
24 #endif | 25 #endif |
25 | 26 |
26 // TODO(dmazzoni): Disabled accessibility tests on Win64. crbug.com/179717 | 27 // TODO(dmazzoni): Disabled accessibility tests on Win64. crbug.com/179717 |
27 #if defined(OS_WIN) && defined(ARCH_CPU_X86_64) | 28 #if defined(OS_WIN) && defined(ARCH_CPU_X86_64) |
28 #define MAYBE_TableSpan DISABLED_TableSpan | 29 #define MAYBE_TableSpan DISABLED_TableSpan |
29 #else | 30 #else |
30 #define MAYBE_TableSpan TableSpan | 31 #define MAYBE_TableSpan TableSpan |
31 #endif | 32 #endif |
32 | 33 |
33 namespace content { | 34 namespace content { |
34 | 35 |
35 class CrossPlatformAccessibilityBrowserTest : public ContentBrowserTest { | 36 class CrossPlatformAccessibilityBrowserTest : public ContentBrowserTest { |
36 public: | 37 public: |
37 CrossPlatformAccessibilityBrowserTest() {} | 38 CrossPlatformAccessibilityBrowserTest() {} |
38 | 39 |
39 // Tell the renderer to send an accessibility tree, then wait for the | 40 // Tell the renderer to send an accessibility tree, then wait for the |
40 // notification that it's been received. | 41 // notification that it's been received. |
41 const ui::AXTree& GetAXTree( | 42 const ui::AXTree& GetAXTree( |
42 AccessibilityMode accessibility_mode = AccessibilityModeComplete) { | 43 unsigned int accessibility_mode = (AccessibilityModeFlagRenderer | |
| 44 AccessibilityModeFlagPlatform)) { |
43 AccessibilityNotificationWaiter waiter( | 45 AccessibilityNotificationWaiter waiter( |
44 shell(), accessibility_mode, ui::AX_EVENT_LAYOUT_COMPLETE); | 46 shell(), accessibility_mode, ui::AX_EVENT_LAYOUT_COMPLETE); |
45 waiter.WaitForNotification(); | 47 waiter.WaitForNotification(); |
46 return waiter.GetAXTree(); | 48 return waiter.GetAXTree(); |
47 } | 49 } |
48 | 50 |
49 // Make sure each node in the tree has an unique id. | 51 // Make sure each node in the tree has an unique id. |
50 void RecursiveAssertUniqueIds( | 52 void RecursiveAssertUniqueIds( |
51 const ui::AXNode* node, base::hash_set<int>* ids) { | 53 const ui::AXNode* node, base::hash_set<int>* ids) { |
52 ASSERT_TRUE(ids->find(node->id()) == ids->end()); | 54 ASSERT_TRUE(ids->find(node->id()) == ids->end()); |
(...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
486 GURL url(url_str); | 488 GURL url(url_str); |
487 NavigateToURL(shell(), url); | 489 NavigateToURL(shell(), url); |
488 const ui::AXTree& tree = GetAXTree(); | 490 const ui::AXTree& tree = GetAXTree(); |
489 const ui::AXNode* root = tree.GetRoot(); | 491 const ui::AXNode* root = tree.GetRoot(); |
490 ASSERT_EQ(1, root->child_count()); | 492 ASSERT_EQ(1, root->child_count()); |
491 const ui::AXNode* textbox = root->ChildAtIndex(0); | 493 const ui::AXNode* textbox = root->ChildAtIndex(0); |
492 EXPECT_EQ(true, GetBoolAttr(textbox, ui::AX_ATTR_CAN_SET_VALUE)); | 494 EXPECT_EQ(true, GetBoolAttr(textbox, ui::AX_ATTR_CAN_SET_VALUE)); |
493 } | 495 } |
494 | 496 |
495 } // namespace content | 497 } // namespace content |
OLD | NEW |