OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #ifndef CONTENT_TEST_ACCESSIBILITY_BROWSER_TEST_UTILS_H_ | 5 #ifndef CONTENT_TEST_ACCESSIBILITY_BROWSER_TEST_UTILS_H_ |
6 #define CONTENT_TEST_ACCESSIBILITY_BROWSER_TEST_UTILS_H_ | 6 #define CONTENT_TEST_ACCESSIBILITY_BROWSER_TEST_UTILS_H_ |
7 | 7 |
8 #include "base/memory/weak_ptr.h" | 8 #include "base/memory/weak_ptr.h" |
9 #include "content/common/view_message_enums.h" | 9 #include "content/common/view_message_enums.h" |
10 #include "ui/accessibility/ax_node_data.h" | 10 #include "ui/accessibility/ax_node_data.h" |
(...skipping 22 matching lines...) Expand all Loading... |
33 | 33 |
34 // Blocks until the specific accessibility notification registered in | 34 // Blocks until the specific accessibility notification registered in |
35 // AccessibilityNotificationWaiter is received. Ignores notifications for | 35 // AccessibilityNotificationWaiter is received. Ignores notifications for |
36 // "about:blank". | 36 // "about:blank". |
37 void WaitForNotification(); | 37 void WaitForNotification(); |
38 | 38 |
39 // After WaitForNotification has returned, this will retrieve | 39 // After WaitForNotification has returned, this will retrieve |
40 // the tree of accessibility nodes received from the renderer process. | 40 // the tree of accessibility nodes received from the renderer process. |
41 const ui::AXTree& GetAXTree() const; | 41 const ui::AXTree& GetAXTree() const; |
42 | 42 |
| 43 // After WaitForNotification returns, use this to retrieve the id of the |
| 44 // node that was the target of the event. |
| 45 int event_target_id() { return event_target_id_; } |
| 46 |
43 private: | 47 private: |
44 // Callback from RenderViewHostImpl. | 48 // Callback from RenderViewHostImpl. |
45 void OnAccessibilityEvent(ui::AXEvent event); | 49 void OnAccessibilityEvent(ui::AXEvent event, int event_target_id); |
46 | 50 |
47 // Helper function to determine if the accessibility tree in | 51 // Helper function to determine if the accessibility tree in |
48 // GetAXTree() is about the page with the url "about:blank". | 52 // GetAXTree() is about the page with the url "about:blank". |
49 bool IsAboutBlank(); | 53 bool IsAboutBlank(); |
50 | 54 |
51 Shell* shell_; | 55 Shell* shell_; |
52 RenderViewHostImpl* view_host_; | 56 RenderViewHostImpl* view_host_; |
53 ui::AXEvent event_to_wait_for_; | 57 ui::AXEvent event_to_wait_for_; |
54 scoped_refptr<MessageLoopRunner> loop_runner_; | 58 scoped_refptr<MessageLoopRunner> loop_runner_; |
55 base::WeakPtrFactory<AccessibilityNotificationWaiter> weak_factory_; | 59 base::WeakPtrFactory<AccessibilityNotificationWaiter> weak_factory_; |
| 60 int event_target_id_; |
56 | 61 |
57 DISALLOW_COPY_AND_ASSIGN(AccessibilityNotificationWaiter); | 62 DISALLOW_COPY_AND_ASSIGN(AccessibilityNotificationWaiter); |
58 }; | 63 }; |
59 | 64 |
60 } // namespace content | 65 } // namespace content |
61 | 66 |
62 #endif // CONTENT_TEST_ACCESSIBILITY_BROWSER_TEST_UTILS_H_ | 67 #endif // CONTENT_TEST_ACCESSIBILITY_BROWSER_TEST_UTILS_H_ |
OLD | NEW |