OLD | NEW |
| (Empty) |
1 // Copyright 2015 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. | |
4 | |
5 #ifndef UI_ACCESSIBILITY_PLATFORM_TEST_AX_NODE_WRAPPER_H_ | |
6 #define UI_ACCESSIBILITY_PLATFORM_TEST_AX_NODE_WRAPPER_H_ | |
7 | |
8 #include "ui/accessibility/ax_node.h" | |
9 #include "ui/accessibility/ax_tree.h" | |
10 #include "ui/accessibility/platform/ax_platform_node.h" | |
11 #include "ui/accessibility/platform/ax_platform_node_delegate.h" | |
12 | |
13 namespace ui { | |
14 | |
15 // For testing, a TestAXNodeWrapper wraps an AXNode, implements | |
16 // AXPlatformNodeDelegate, and owns an AXPlatformNode. | |
17 class TestAXNodeWrapper : public AXPlatformNodeDelegate { | |
18 public: | |
19 // Create TestAXNodeWrapper instances on-demand from an AXTree and AXNode. | |
20 // Note that this sets the AXTreeDelegate, you can't use this class if | |
21 // you also want to implement AXTreeDelegate. | |
22 static TestAXNodeWrapper* GetOrCreate(AXTree* tree, AXNode* node); | |
23 | |
24 // Set a global coordinate offset for testing. | |
25 static void SetGlobalCoordinateOffset(const gfx::Vector2d& offset); | |
26 | |
27 virtual ~TestAXNodeWrapper(); | |
28 | |
29 AXPlatformNode* ax_platform_node() { return platform_node_; } | |
30 | |
31 // AXPlatformNodeDelegate. | |
32 const AXNodeData& GetData() override; | |
33 gfx::NativeViewAccessible GetParent() override; | |
34 int GetChildCount() override; | |
35 gfx::NativeViewAccessible ChildAtIndex(int index) override; | |
36 gfx::Vector2d GetGlobalCoordinateOffset() override; | |
37 gfx::NativeViewAccessible HitTestSync(int x, int y) override; | |
38 gfx::NativeViewAccessible GetFocus() override; | |
39 gfx::AcceleratedWidget GetTargetForNativeAccessibilityEvent() override; | |
40 void DoDefaultAction() override; | |
41 bool SetStringValue(const base::string16& new_value) override; | |
42 | |
43 private: | |
44 TestAXNodeWrapper(AXTree* tree, AXNode* node); | |
45 | |
46 AXTree* tree_; | |
47 AXNode* node_; | |
48 AXPlatformNode* platform_node_; | |
49 }; | |
50 | |
51 } // namespace ui | |
52 | |
53 #endif // UI_ACCESSIBILITY_PLATFORM_TEST_AX_NODE_WRAPPER_H_ | |
OLD | NEW |