Cast: Stop logging kVideoFrameSentToEncoder and rename a couple events.
[chromium-blink-merge.git] / content / test / accessibility_browser_test_utils.h
blob4cffa08435a0d2ce8b120c310daec511445e2b92
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
3 // found in the LICENSE file.
5 #ifndef CONTENT_TEST_ACCESSIBILITY_BROWSER_TEST_UTILS_H_
6 #define CONTENT_TEST_ACCESSIBILITY_BROWSER_TEST_UTILS_H_
8 #include "base/memory/weak_ptr.h"
9 #include "content/common/view_message_enums.h"
10 #include "ui/accessibility/ax_node_data.h"
11 #include "ui/accessibility/ax_tree.h"
13 namespace content {
15 class MessageLoopRunner;
16 class RenderViewHostImpl;
17 class Shell;
19 // Create an instance of this class *before* doing any operation that
20 // might generate an accessibility event (like a page navigation or
21 // clicking on a button). Then call WaitForNotification
22 // afterwards to block until the specified accessibility notification has been
23 // received.
24 class AccessibilityNotificationWaiter {
25 public:
26 explicit AccessibilityNotificationWaiter(Shell* shell);
28 AccessibilityNotificationWaiter(
29 Shell* shell,
30 AccessibilityMode accessibility_mode,
31 ui::AXEvent event);
32 ~AccessibilityNotificationWaiter();
34 // Blocks until the specific accessibility notification registered in
35 // AccessibilityNotificationWaiter is received. Ignores notifications for
36 // "about:blank".
37 void WaitForNotification();
39 // After WaitForNotification has returned, this will retrieve
40 // the tree of accessibility nodes received from the renderer process.
41 const ui::AXTree& GetAXTree() const;
43 private:
44 // Callback from RenderViewHostImpl.
45 void OnAccessibilityEvent(ui::AXEvent event);
47 // Helper function to determine if the accessibility tree in
48 // GetAXTree() is about the page with the url "about:blank".
49 bool IsAboutBlank();
51 Shell* shell_;
52 RenderViewHostImpl* view_host_;
53 ui::AXEvent event_to_wait_for_;
54 scoped_refptr<MessageLoopRunner> loop_runner_;
55 base::WeakPtrFactory<AccessibilityNotificationWaiter> weak_factory_;
57 DISALLOW_COPY_AND_ASSIGN(AccessibilityNotificationWaiter);
60 } // namespace content
62 #endif // CONTENT_TEST_ACCESSIBILITY_BROWSER_TEST_UTILS_H_