Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(328)

Side by Side Diff: components/test_runner/web_ax_object_proxy.h

Issue 2707183003: Move //components/test_runner back into //content/shell (Closed)
Patch Set: Trim DEPS Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2014 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 COMPONENTS_TEST_RUNNER_WEB_AX_OBJECT_PROXY_H_
6 #define COMPONENTS_TEST_RUNNER_WEB_AX_OBJECT_PROXY_H_
7
8 #include <stdint.h>
9
10 #include <string>
11
12 #include "base/macros.h"
13 #include "gin/object_template_builder.h"
14 #include "gin/wrappable.h"
15 #include "third_party/WebKit/public/web/WebAXObject.h"
16 #include "v8/include/v8-util.h"
17 #include "v8/include/v8.h"
18
19 namespace blink {
20 class WebFrame;
21 }
22
23 namespace test_runner {
24
25 class WebAXObjectProxy : public gin::Wrappable<WebAXObjectProxy> {
26 public:
27 class Factory {
28 public:
29 virtual ~Factory() { }
30 virtual v8::Local<v8::Object> GetOrCreate(
31 const blink::WebAXObject& object) = 0;
32 };
33
34 static gin::WrapperInfo kWrapperInfo;
35
36 WebAXObjectProxy(const blink::WebAXObject& object, Factory* factory);
37 ~WebAXObjectProxy() override;
38
39 // gin::Wrappable:
40 gin::ObjectTemplateBuilder GetObjectTemplateBuilder(
41 v8::Isolate* isolate) override;
42
43 virtual v8::Local<v8::Object> GetChildAtIndex(unsigned index);
44 virtual bool IsRoot() const;
45 bool IsEqualToObject(const blink::WebAXObject& object);
46
47 void NotificationReceived(blink::WebFrame* frame,
48 const std::string& notification_name);
49 void Reset();
50
51 protected:
52 const blink::WebAXObject& accessibility_object() const {
53 return accessibility_object_;
54 }
55
56 Factory* factory() const { return factory_; }
57
58 private:
59 friend class WebAXObjectProxyBindings;
60
61 // Bound properties.
62 std::string Role();
63 std::string StringValue();
64 std::string Language();
65 int X();
66 int Y();
67 int Width();
68 int Height();
69 int IntValue();
70 int MinValue();
71 int MaxValue();
72 std::string ValueDescription();
73 int ChildrenCount();
74
75 // The following selection functions return global information about the
76 // current selection and can be called on any object in the tree.
77 v8::Local<v8::Value> SelectionAnchorObject();
78 int SelectionAnchorOffset();
79 std::string SelectionAnchorAffinity();
80 v8::Local<v8::Value> SelectionFocusObject();
81 int SelectionFocusOffset();
82 std::string SelectionFocusAffinity();
83
84 // The following selection functions return text offsets calculated starting
85 // at this object. They only report on a selection that is placed on the
86 // current object or on any of its descendants.
87 // For example, they can be used to retrieve the selection in an input or
88 // a textarea.
89 int SelectionStart();
90 int SelectionEnd();
91 int SelectionStartLineNumber();
92 int SelectionEndLineNumber();
93
94 bool IsEnabled();
95 bool IsRequired();
96 bool IsEditable();
97 bool IsRichlyEditable();
98 bool IsFocused();
99 bool IsFocusable();
100 bool IsModal();
101 bool IsSelected();
102 bool IsSelectable();
103 bool IsMultiSelectable();
104 bool IsSelectedOptionActive();
105 bool IsExpanded();
106 bool IsChecked();
107 bool IsVisible();
108 bool IsOffScreen();
109 bool IsCollapsed();
110 bool HasPopup();
111 bool IsValid();
112 bool IsReadOnly();
113 unsigned int BackgroundColor();
114 unsigned int Color();
115 // For input elements of type color.
116 unsigned int ColorValue();
117 std::string FontFamily();
118 float FontSize();
119 std::string Orientation();
120 int PosInSet();
121 int SetSize();
122 int ClickPointX();
123 int ClickPointY();
124 int32_t RowCount();
125 int32_t RowHeadersCount();
126 int32_t ColumnCount();
127 int32_t ColumnHeadersCount();
128 bool IsClickable();
129 bool IsButtonStateMixed();
130 float BoundsX();
131 float BoundsY();
132 float BoundsWidth();
133 float BoundsHeight();
134
135 // Bound methods.
136 v8::Local<v8::Object> AriaControlsElementAtIndex(unsigned index);
137 v8::Local<v8::Object> AriaFlowToElementAtIndex(unsigned index);
138 v8::Local<v8::Object> AriaOwnsElementAtIndex(unsigned index);
139 std::string AllAttributes();
140 std::string AttributesOfChildren();
141 int LineForIndex(int index);
142 std::string BoundsForRange(int start, int end);
143 v8::Local<v8::Object> ChildAtIndex(int index);
144 v8::Local<v8::Object> ElementAtPoint(int x, int y);
145 v8::Local<v8::Object> TableHeader();
146 v8::Local<v8::Object> RowHeaderAtIndex(unsigned index);
147 v8::Local<v8::Object> ColumnHeaderAtIndex(unsigned index);
148 std::string RowIndexRange();
149 std::string ColumnIndexRange();
150 v8::Local<v8::Object> CellForColumnAndRow(int column, int row);
151 void SetSelectedTextRange(int selection_start, int length);
152 void SetSelection(v8::Local<v8::Value> anchor_object, int anchor_offset,
153 v8::Local<v8::Value> focus_object, int focus_offset);
154 bool IsAttributeSettable(const std::string& attribute);
155 bool IsPressActionSupported();
156 bool IsIncrementActionSupported();
157 bool IsDecrementActionSupported();
158 v8::Local<v8::Object> ParentElement();
159 void Increment();
160 void Decrement();
161 void ShowMenu();
162 void Press();
163 bool SetValue(const std::string& value);
164 bool IsEqual(v8::Local<v8::Object> proxy);
165 void SetNotificationListener(v8::Local<v8::Function> callback);
166 void UnsetNotificationListener();
167 void TakeFocus();
168 void ScrollToMakeVisible();
169 void ScrollToMakeVisibleWithSubFocus(int x, int y, int width, int height);
170 void ScrollToGlobalPoint(int x, int y);
171 int ScrollX();
172 int ScrollY();
173 int WordStart(int character_index);
174 int WordEnd(int character_index);
175 v8::Local<v8::Object> NextOnLine();
176 v8::Local<v8::Object> PreviousOnLine();
177 std::string MisspellingAtIndex(int index);
178 v8::Local<v8::Object> OffsetContainer();
179 float BoundsInContainerX();
180 float BoundsInContainerY();
181 float BoundsInContainerWidth();
182 float BoundsInContainerHeight();
183 bool HasNonIdentityTransform();
184
185 std::string Name();
186 std::string NameFrom();
187 int NameElementCount();
188 v8::Local<v8::Object> NameElementAtIndex(unsigned index);
189
190 std::string Description();
191 std::string DescriptionFrom();
192 int MisspellingsCount();
193 int DescriptionElementCount();
194 v8::Local<v8::Object> DescriptionElementAtIndex(unsigned index);
195
196 std::string Placeholder();
197
198 blink::WebAXObject accessibility_object_;
199 Factory* factory_;
200
201 v8::Persistent<v8::Function> notification_callback_;
202
203 DISALLOW_COPY_AND_ASSIGN(WebAXObjectProxy);
204 };
205
206 class RootWebAXObjectProxy : public WebAXObjectProxy {
207 public:
208 RootWebAXObjectProxy(const blink::WebAXObject&, Factory*);
209
210 v8::Local<v8::Object> GetChildAtIndex(unsigned index) override;
211 bool IsRoot() const override;
212 };
213
214
215 // Provides simple lifetime management of the WebAXObjectProxy instances: all
216 // WebAXObjectProxys ever created from the controller are stored in a list and
217 // cleared explicitly.
218 class WebAXObjectProxyList : public WebAXObjectProxy::Factory {
219 public:
220 WebAXObjectProxyList();
221 ~WebAXObjectProxyList() override;
222
223 void Clear();
224 v8::Local<v8::Object> GetOrCreate(const blink::WebAXObject&) override;
225
226 private:
227 typedef v8::PersistentValueVector<v8::Object> ElementList;
228 ElementList elements_;
229 };
230
231 } // namespace test_runner
232
233 #endif // COMPONENTS_TEST_RUNNER_WEB_AX_OBJECT_PROXY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698