OLD | NEW |
| (Empty) |
1 // Copyright (c) 2011 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 #include <string> | |
6 #include <vector> | |
7 | |
8 #include "base/utf_string_conversions.h" | |
9 #include "chrome/browser/ui/browser.h" | |
10 #include "chrome/browser/ui/browser_window.h" | |
11 #include "chrome/common/render_messages.h" | |
12 #include "chrome/test/base/in_process_browser_test.h" | |
13 #include "chrome/test/base/ui_test_utils.h" | |
14 #include "content/browser/renderer_host/render_view_host.h" | |
15 #include "content/browser/renderer_host/render_widget_host.h" | |
16 #include "content/browser/renderer_host/render_widget_host_view.h" | |
17 #include "content/browser/tab_contents/tab_contents.h" | |
18 #include "content/public/browser/notification_service.h" | |
19 #include "content/public/browser/notification_types.h" | |
20 | |
21 #if defined(OS_WIN) | |
22 #include <atlbase.h> | |
23 #include <atlcom.h> | |
24 #include "ui/base/win/atl_module.h" | |
25 #endif | |
26 | |
27 using webkit_glue::WebAccessibility; | |
28 | |
29 namespace { | |
30 | |
31 class RendererAccessibilityBrowserTest : public InProcessBrowserTest { | |
32 public: | |
33 RendererAccessibilityBrowserTest() {} | |
34 | |
35 // Tell the renderer to send an accessibility tree, then wait for the | |
36 // notification that it's been received. | |
37 const WebAccessibility& GetWebAccessibilityTree() { | |
38 ui_test_utils::WindowedNotificationObserver tree_updated_observer( | |
39 content::NOTIFICATION_RENDER_VIEW_HOST_ACCESSIBILITY_TREE_UPDATED, | |
40 content::NotificationService::AllSources()); | |
41 RenderWidgetHostView* host_view = | |
42 browser()->GetSelectedTabContents()->GetRenderWidgetHostView(); | |
43 RenderWidgetHost* host = host_view->GetRenderWidgetHost(); | |
44 RenderViewHost* view_host = static_cast<RenderViewHost*>(host); | |
45 view_host->set_save_accessibility_tree_for_testing(true); | |
46 view_host->EnableRendererAccessibility(); | |
47 tree_updated_observer.Wait(); | |
48 return view_host->accessibility_tree_for_testing(); | |
49 } | |
50 | |
51 // Make sure each node in the tree has an unique id. | |
52 void RecursiveAssertUniqueIds( | |
53 const WebAccessibility& node, base::hash_set<int>* ids) { | |
54 ASSERT_TRUE(ids->find(node.id) == ids->end()); | |
55 ids->insert(node.id); | |
56 for (size_t i = 0; i < node.children.size(); i++) | |
57 RecursiveAssertUniqueIds(node.children[i], ids); | |
58 } | |
59 | |
60 // InProcessBrowserTest | |
61 void SetUpInProcessBrowserTestFixture(); | |
62 void TearDownInProcessBrowserTestFixture(); | |
63 | |
64 protected: | |
65 std::string GetAttr(const WebAccessibility& node, | |
66 const WebAccessibility::StringAttribute attr); | |
67 int GetIntAttr(const WebAccessibility& node, | |
68 const WebAccessibility::IntAttribute attr); | |
69 bool GetBoolAttr(const WebAccessibility& node, | |
70 const WebAccessibility::BoolAttribute attr); | |
71 }; | |
72 | |
73 void RendererAccessibilityBrowserTest::SetUpInProcessBrowserTestFixture() { | |
74 #if defined(OS_WIN) | |
75 ui::win::CreateATLModuleIfNeeded(); | |
76 ::CoInitialize(NULL); | |
77 #endif | |
78 } | |
79 | |
80 void RendererAccessibilityBrowserTest::TearDownInProcessBrowserTestFixture() { | |
81 #if defined(OS_WIN) | |
82 ::CoUninitialize(); | |
83 #endif | |
84 } | |
85 | |
86 // Convenience method to get the value of a particular WebAccessibility | |
87 // node attribute as a UTF-8 const char*. | |
88 std::string RendererAccessibilityBrowserTest::GetAttr( | |
89 const WebAccessibility& node, | |
90 const WebAccessibility::StringAttribute attr) { | |
91 std::map<WebAccessibility::StringAttribute, string16>::const_iterator iter = | |
92 node.string_attributes.find(attr); | |
93 if (iter != node.string_attributes.end()) | |
94 return UTF16ToUTF8(iter->second); | |
95 else | |
96 return ""; | |
97 } | |
98 | |
99 // Convenience method to get the value of a particular WebAccessibility | |
100 // node integer attribute. | |
101 int RendererAccessibilityBrowserTest::GetIntAttr( | |
102 const WebAccessibility& node, | |
103 const WebAccessibility::IntAttribute attr) { | |
104 std::map<WebAccessibility::IntAttribute, int32>::const_iterator iter = | |
105 node.int_attributes.find(attr); | |
106 if (iter != node.int_attributes.end()) | |
107 return iter->second; | |
108 else | |
109 return -1; | |
110 } | |
111 | |
112 // Convenience method to get the value of a particular WebAccessibility | |
113 // node boolean attribute. | |
114 bool RendererAccessibilityBrowserTest::GetBoolAttr( | |
115 const WebAccessibility& node, | |
116 const WebAccessibility::BoolAttribute attr) { | |
117 std::map<WebAccessibility::BoolAttribute, bool>::const_iterator iter = | |
118 node.bool_attributes.find(attr); | |
119 if (iter != node.bool_attributes.end()) | |
120 return iter->second; | |
121 else | |
122 return false; | |
123 } | |
124 | |
125 // Marked flaky per http://crbug.com/101984 | |
126 IN_PROC_BROWSER_TEST_F(RendererAccessibilityBrowserTest, | |
127 FLAKY_CrossPlatformWebpageAccessibility) { | |
128 // Create a data url and load it. | |
129 const char url_str[] = | |
130 "data:text/html," | |
131 "<!doctype html>" | |
132 "<html><head><title>Accessibility Test</title></head>" | |
133 "<body><input type='button' value='push' /><input type='checkbox' />" | |
134 "</body></html>"; | |
135 GURL url(url_str); | |
136 browser()->OpenURL(url, GURL(), CURRENT_TAB, content::PAGE_TRANSITION_TYPED); | |
137 const WebAccessibility& tree = GetWebAccessibilityTree(); | |
138 | |
139 // Check properties of the root element of the tree. | |
140 EXPECT_STREQ(url_str, GetAttr(tree, WebAccessibility::ATTR_DOC_URL).c_str()); | |
141 EXPECT_STREQ( | |
142 "Accessibility Test", | |
143 GetAttr(tree, WebAccessibility::ATTR_DOC_TITLE).c_str()); | |
144 EXPECT_STREQ( | |
145 "html", GetAttr(tree, WebAccessibility::ATTR_DOC_DOCTYPE).c_str()); | |
146 EXPECT_STREQ( | |
147 "text/html", GetAttr(tree, WebAccessibility::ATTR_DOC_MIMETYPE).c_str()); | |
148 EXPECT_STREQ("Accessibility Test", UTF16ToUTF8(tree.name).c_str()); | |
149 EXPECT_EQ(WebAccessibility::ROLE_ROOT_WEB_AREA, tree.role); | |
150 | |
151 // Check properites of the BODY element. | |
152 ASSERT_EQ(1U, tree.children.size()); | |
153 const WebAccessibility& body = tree.children[0]; | |
154 EXPECT_EQ(WebAccessibility::ROLE_GROUP, body.role); | |
155 EXPECT_STREQ("body", GetAttr(body, WebAccessibility::ATTR_HTML_TAG).c_str()); | |
156 EXPECT_STREQ("block", GetAttr(body, WebAccessibility::ATTR_DISPLAY).c_str()); | |
157 | |
158 // Check properties of the two children of the BODY element. | |
159 ASSERT_EQ(2U, body.children.size()); | |
160 | |
161 const WebAccessibility& button = body.children[0]; | |
162 EXPECT_EQ(WebAccessibility::ROLE_BUTTON, button.role); | |
163 EXPECT_STREQ( | |
164 "input", GetAttr(button, WebAccessibility::ATTR_HTML_TAG).c_str()); | |
165 EXPECT_STREQ("push", UTF16ToUTF8(button.name).c_str()); | |
166 EXPECT_STREQ( | |
167 "inline-block", GetAttr(button, WebAccessibility::ATTR_DISPLAY).c_str()); | |
168 ASSERT_EQ(2U, button.html_attributes.size()); | |
169 EXPECT_STREQ("type", UTF16ToUTF8(button.html_attributes[0].first).c_str()); | |
170 EXPECT_STREQ("button", UTF16ToUTF8(button.html_attributes[0].second).c_str()); | |
171 EXPECT_STREQ("value", UTF16ToUTF8(button.html_attributes[1].first).c_str()); | |
172 EXPECT_STREQ("push", UTF16ToUTF8(button.html_attributes[1].second).c_str()); | |
173 | |
174 const WebAccessibility& checkbox = body.children[1]; | |
175 EXPECT_EQ(WebAccessibility::ROLE_CHECKBOX, checkbox.role); | |
176 EXPECT_STREQ( | |
177 "input", GetAttr(checkbox, WebAccessibility::ATTR_HTML_TAG).c_str()); | |
178 EXPECT_STREQ( | |
179 "inline-block", | |
180 GetAttr(checkbox, WebAccessibility::ATTR_DISPLAY).c_str()); | |
181 ASSERT_EQ(1U, checkbox.html_attributes.size()); | |
182 EXPECT_STREQ( | |
183 "type", UTF16ToUTF8(checkbox.html_attributes[0].first).c_str()); | |
184 EXPECT_STREQ( | |
185 "checkbox", UTF16ToUTF8(checkbox.html_attributes[0].second).c_str()); | |
186 } | |
187 | |
188 IN_PROC_BROWSER_TEST_F(RendererAccessibilityBrowserTest, | |
189 CrossPlatformUnselectedEditableTextAccessibility) { | |
190 // Create a data url and load it. | |
191 const char url_str[] = | |
192 "data:text/html," | |
193 "<!doctype html>" | |
194 "<body>" | |
195 "<input value=\"Hello, world.\"/>" | |
196 "</body></html>"; | |
197 GURL url(url_str); | |
198 browser()->OpenURL(url, GURL(), CURRENT_TAB, content::PAGE_TRANSITION_TYPED); | |
199 | |
200 const WebAccessibility& tree = GetWebAccessibilityTree(); | |
201 ASSERT_EQ(1U, tree.children.size()); | |
202 const WebAccessibility& body = tree.children[0]; | |
203 ASSERT_EQ(1U, body.children.size()); | |
204 const WebAccessibility& text = body.children[0]; | |
205 EXPECT_EQ(WebAccessibility::ROLE_TEXT_FIELD, text.role); | |
206 EXPECT_STREQ( | |
207 "input", GetAttr(text, WebAccessibility::ATTR_HTML_TAG).c_str()); | |
208 EXPECT_EQ(0, GetIntAttr(text, WebAccessibility::ATTR_TEXT_SEL_START)); | |
209 EXPECT_EQ(0, GetIntAttr(text, WebAccessibility::ATTR_TEXT_SEL_END)); | |
210 EXPECT_STREQ("Hello, world.", UTF16ToUTF8(text.value).c_str()); | |
211 | |
212 // TODO(dmazzoni): as soon as more accessibility code is cross-platform, | |
213 // this code should test that the accessible info is dynamically updated | |
214 // if the selection or value changes. | |
215 } | |
216 | |
217 IN_PROC_BROWSER_TEST_F(RendererAccessibilityBrowserTest, | |
218 CrossPlatformSelectedEditableTextAccessibility) { | |
219 // Create a data url and load it. | |
220 const char url_str[] = | |
221 "data:text/html," | |
222 "<!doctype html>" | |
223 "<body onload=\"document.body.children[0].select();\">" | |
224 "<input value=\"Hello, world.\"/>" | |
225 "</body></html>"; | |
226 GURL url(url_str); | |
227 browser()->OpenURL(url, GURL(), CURRENT_TAB, content::PAGE_TRANSITION_TYPED); | |
228 | |
229 const WebAccessibility& tree = GetWebAccessibilityTree(); | |
230 ASSERT_EQ(1U, tree.children.size()); | |
231 const WebAccessibility& body = tree.children[0]; | |
232 ASSERT_EQ(1U, body.children.size()); | |
233 const WebAccessibility& text = body.children[0]; | |
234 EXPECT_EQ(WebAccessibility::ROLE_TEXT_FIELD, text.role); | |
235 EXPECT_STREQ( | |
236 "input", GetAttr(text, WebAccessibility::ATTR_HTML_TAG).c_str()); | |
237 EXPECT_EQ(0, GetIntAttr(text, WebAccessibility::ATTR_TEXT_SEL_START)); | |
238 EXPECT_EQ(13, GetIntAttr(text, WebAccessibility::ATTR_TEXT_SEL_END)); | |
239 EXPECT_STREQ("Hello, world.", UTF16ToUTF8(text.value).c_str()); | |
240 } | |
241 | |
242 IN_PROC_BROWSER_TEST_F(RendererAccessibilityBrowserTest, | |
243 CrossPlatformMultipleInheritanceAccessibility) { | |
244 // In a WebKit accessibility render tree for a table, each cell is a | |
245 // child of both a row and a column, so it appears to use multiple | |
246 // inheritance. Make sure that the WebAccessibilityObject tree only | |
247 // keeps one copy of each cell, and uses an indirect child id for the | |
248 // additional reference to it. | |
249 const char url_str[] = | |
250 "data:text/html," | |
251 "<!doctype html>" | |
252 "<table border=1><tr><td>1</td><td>2</td></tr></table>"; | |
253 GURL url(url_str); | |
254 browser()->OpenURL(url, GURL(), CURRENT_TAB, content::PAGE_TRANSITION_TYPED); | |
255 | |
256 const WebAccessibility& tree = GetWebAccessibilityTree(); | |
257 ASSERT_EQ(1U, tree.children.size()); | |
258 const WebAccessibility& table = tree.children[0]; | |
259 EXPECT_EQ(WebAccessibility::ROLE_TABLE, table.role); | |
260 const WebAccessibility& row = table.children[0]; | |
261 EXPECT_EQ(WebAccessibility::ROLE_ROW, row.role); | |
262 const WebAccessibility& cell1 = row.children[0]; | |
263 EXPECT_EQ(WebAccessibility::ROLE_CELL, cell1.role); | |
264 const WebAccessibility& cell2 = row.children[1]; | |
265 EXPECT_EQ(WebAccessibility::ROLE_CELL, cell2.role); | |
266 const WebAccessibility& column1 = table.children[1]; | |
267 EXPECT_EQ(WebAccessibility::ROLE_COLUMN, column1.role); | |
268 EXPECT_EQ(0U, column1.children.size()); | |
269 EXPECT_EQ(1U, column1.indirect_child_ids.size()); | |
270 EXPECT_EQ(cell1.id, column1.indirect_child_ids[0]); | |
271 const WebAccessibility& column2 = table.children[2]; | |
272 EXPECT_EQ(WebAccessibility::ROLE_COLUMN, column2.role); | |
273 EXPECT_EQ(0U, column2.children.size()); | |
274 EXPECT_EQ(1U, column2.indirect_child_ids.size()); | |
275 EXPECT_EQ(cell2.id, column2.indirect_child_ids[0]); | |
276 } | |
277 | |
278 IN_PROC_BROWSER_TEST_F(RendererAccessibilityBrowserTest, | |
279 CrossPlatformMultipleInheritanceAccessibility2) { | |
280 // Here's another html snippet where WebKit puts the same node as a child | |
281 // of two different parents. Instead of checking the exact output, just | |
282 // make sure that no id is reused in the resulting tree. | |
283 const char url_str[] = | |
284 "data:text/html," | |
285 "<!doctype html>" | |
286 "<script>\n" | |
287 " document.writeln('<q><section></section></q><q><li>');\n" | |
288 " setTimeout(function() {\n" | |
289 " document.close();\n" | |
290 " }, 1);\n" | |
291 "</script>"; | |
292 GURL url(url_str); | |
293 browser()->OpenURL(url, GURL(), CURRENT_TAB, content::PAGE_TRANSITION_TYPED); | |
294 | |
295 const WebAccessibility& tree = GetWebAccessibilityTree(); | |
296 base::hash_set<int> ids; | |
297 RecursiveAssertUniqueIds(tree, &ids); | |
298 } | |
299 | |
300 IN_PROC_BROWSER_TEST_F(RendererAccessibilityBrowserTest, | |
301 CrossPlatformIframeAccessibility) { | |
302 // Create a data url and load it. | |
303 const char url_str[] = | |
304 "data:text/html," | |
305 "<!doctype html><html><body>" | |
306 "<button>Button 1</button>" | |
307 "<iframe src='data:text/html," | |
308 "<!doctype html><html><body><button>Button 2</button></body></html>" | |
309 "'></iframe>" | |
310 "<button>Button 3</button>" | |
311 "</body></html>"; | |
312 GURL url(url_str); | |
313 browser()->OpenURL(url, GURL(), CURRENT_TAB, content::PAGE_TRANSITION_TYPED); | |
314 | |
315 const WebAccessibility& tree = GetWebAccessibilityTree(); | |
316 ASSERT_EQ(1U, tree.children.size()); | |
317 const WebAccessibility& body = tree.children[0]; | |
318 ASSERT_EQ(3U, body.children.size()); | |
319 | |
320 const WebAccessibility& button1 = body.children[0]; | |
321 EXPECT_EQ(WebAccessibility::ROLE_BUTTON, button1.role); | |
322 EXPECT_STREQ("Button 1", UTF16ToUTF8(button1.name).c_str()); | |
323 | |
324 const WebAccessibility& iframe = body.children[1]; | |
325 EXPECT_STREQ("iframe", | |
326 GetAttr(iframe, WebAccessibility::ATTR_HTML_TAG).c_str()); | |
327 ASSERT_EQ(1U, iframe.children.size()); | |
328 | |
329 const WebAccessibility& scroll_area = iframe.children[0]; | |
330 EXPECT_EQ(WebAccessibility::ROLE_SCROLLAREA, scroll_area.role); | |
331 ASSERT_EQ(1U, scroll_area.children.size()); | |
332 | |
333 const WebAccessibility& sub_document = scroll_area.children[0]; | |
334 EXPECT_EQ(WebAccessibility::ROLE_WEB_AREA, sub_document.role); | |
335 ASSERT_EQ(1U, sub_document.children.size()); | |
336 | |
337 const WebAccessibility& sub_body = sub_document.children[0]; | |
338 ASSERT_EQ(1U, sub_body.children.size()); | |
339 | |
340 const WebAccessibility& button2 = sub_body.children[0]; | |
341 EXPECT_EQ(WebAccessibility::ROLE_BUTTON, button2.role); | |
342 EXPECT_STREQ("Button 2", UTF16ToUTF8(button2.name).c_str()); | |
343 | |
344 const WebAccessibility& button3 = body.children[2]; | |
345 EXPECT_EQ(WebAccessibility::ROLE_BUTTON, button3.role); | |
346 EXPECT_STREQ("Button 3", UTF16ToUTF8(button3.name).c_str()); | |
347 } | |
348 | |
349 IN_PROC_BROWSER_TEST_F(RendererAccessibilityBrowserTest, | |
350 CrossPlatformDuplicateChildrenAccessibility) { | |
351 // Here's another html snippet where WebKit has a parent node containing | |
352 // two duplicate child nodes. Instead of checking the exact output, just | |
353 // make sure that no id is reused in the resulting tree. | |
354 const char url_str[] = | |
355 "data:text/html," | |
356 "<!doctype html>" | |
357 "<em><code ><h4 ></em>"; | |
358 GURL url(url_str); | |
359 browser()->OpenURL(url, GURL(), CURRENT_TAB, content::PAGE_TRANSITION_TYPED); | |
360 | |
361 const WebAccessibility& tree = GetWebAccessibilityTree(); | |
362 base::hash_set<int> ids; | |
363 RecursiveAssertUniqueIds(tree, &ids); | |
364 } | |
365 | |
366 IN_PROC_BROWSER_TEST_F(RendererAccessibilityBrowserTest, | |
367 CrossPlatformTableSpan) { | |
368 // +---+---+---+ | |
369 // | 1 | 2 | | |
370 // +---+---+---+ | |
371 // | 3 | 4 | | |
372 // +---+---+---+ | |
373 | |
374 const char url_str[] = | |
375 "data:text/html," | |
376 "<!doctype html>" | |
377 "<table border=1>" | |
378 " <tr>" | |
379 " <td colspan=2>1</td><td>2</td>" | |
380 " </tr>" | |
381 " <tr>" | |
382 " <td>3</td><td colspan=2>4</td>" | |
383 " </tr>" | |
384 "</table>"; | |
385 GURL url(url_str); | |
386 browser()->OpenURL(url, GURL(), CURRENT_TAB, content::PAGE_TRANSITION_TYPED); | |
387 | |
388 const WebAccessibility& tree = GetWebAccessibilityTree(); | |
389 const WebAccessibility& table = tree.children[0]; | |
390 EXPECT_EQ(WebAccessibility::ROLE_TABLE, table.role); | |
391 ASSERT_GE(table.children.size(), 5U); | |
392 EXPECT_EQ(WebAccessibility::ROLE_ROW, table.children[0].role); | |
393 EXPECT_EQ(WebAccessibility::ROLE_ROW, table.children[1].role); | |
394 EXPECT_EQ(WebAccessibility::ROLE_COLUMN, table.children[2].role); | |
395 EXPECT_EQ(WebAccessibility::ROLE_COLUMN, table.children[3].role); | |
396 EXPECT_EQ(WebAccessibility::ROLE_COLUMN, table.children[4].role); | |
397 EXPECT_EQ(3, GetIntAttr(table, WebAccessibility::ATTR_TABLE_COLUMN_COUNT)); | |
398 EXPECT_EQ(2, GetIntAttr(table, WebAccessibility::ATTR_TABLE_ROW_COUNT)); | |
399 | |
400 const WebAccessibility& cell1 = table.children[0].children[0]; | |
401 const WebAccessibility& cell2 = table.children[0].children[1]; | |
402 const WebAccessibility& cell3 = table.children[1].children[0]; | |
403 const WebAccessibility& cell4 = table.children[1].children[1]; | |
404 | |
405 ASSERT_EQ(6U, table.cell_ids.size()); | |
406 EXPECT_EQ(cell1.id, table.cell_ids[0]); | |
407 EXPECT_EQ(cell1.id, table.cell_ids[1]); | |
408 EXPECT_EQ(cell2.id, table.cell_ids[2]); | |
409 EXPECT_EQ(cell3.id, table.cell_ids[3]); | |
410 EXPECT_EQ(cell4.id, table.cell_ids[4]); | |
411 EXPECT_EQ(cell4.id, table.cell_ids[5]); | |
412 | |
413 EXPECT_EQ(0, GetIntAttr(cell1, | |
414 WebAccessibility::ATTR_TABLE_CELL_COLUMN_INDEX)); | |
415 EXPECT_EQ(0, GetIntAttr(cell1, | |
416 WebAccessibility::ATTR_TABLE_CELL_ROW_INDEX)); | |
417 EXPECT_EQ(2, GetIntAttr(cell1, | |
418 WebAccessibility::ATTR_TABLE_CELL_COLUMN_SPAN)); | |
419 EXPECT_EQ(1, GetIntAttr(cell1, | |
420 WebAccessibility::ATTR_TABLE_CELL_ROW_SPAN)); | |
421 EXPECT_EQ(2, GetIntAttr(cell2, | |
422 WebAccessibility::ATTR_TABLE_CELL_COLUMN_INDEX)); | |
423 EXPECT_EQ(1, GetIntAttr(cell2, | |
424 WebAccessibility::ATTR_TABLE_CELL_COLUMN_SPAN)); | |
425 EXPECT_EQ(0, GetIntAttr(cell3, | |
426 WebAccessibility::ATTR_TABLE_CELL_COLUMN_INDEX)); | |
427 EXPECT_EQ(1, GetIntAttr(cell3, | |
428 WebAccessibility::ATTR_TABLE_CELL_COLUMN_SPAN)); | |
429 EXPECT_EQ(1, GetIntAttr(cell4, | |
430 WebAccessibility::ATTR_TABLE_CELL_COLUMN_INDEX)); | |
431 EXPECT_EQ(2, GetIntAttr(cell4, | |
432 WebAccessibility::ATTR_TABLE_CELL_COLUMN_SPAN)); | |
433 } | |
434 | |
435 IN_PROC_BROWSER_TEST_F(RendererAccessibilityBrowserTest, | |
436 CrossPlatformWritableElement) { | |
437 const char url_str[] = | |
438 "data:text/html," | |
439 "<!doctype html>" | |
440 "<div role='textbox' tabindex=0>" | |
441 " Some text" | |
442 "</div>"; | |
443 GURL url(url_str); | |
444 browser()->OpenURL(url, GURL(), CURRENT_TAB, content::PAGE_TRANSITION_TYPED); | |
445 const WebAccessibility& tree = GetWebAccessibilityTree(); | |
446 | |
447 ASSERT_EQ(1U, tree.children.size()); | |
448 const WebAccessibility& textbox = tree.children[0]; | |
449 | |
450 EXPECT_EQ( | |
451 true, GetBoolAttr(textbox, WebAccessibility::ATTR_CAN_SET_VALUE)); | |
452 } | |
453 | |
454 } // namespace | |
OLD | NEW |