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

Side by Side Diff: content/browser/accessibility/cross_platform_accessibility_browsertest.cc

Issue 10834034: Move accessibility browser tests to content_browsertests. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 4 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #include <string> 5 #include <string>
6 #include <vector> 6 #include <vector>
7 7
8 #include "base/utf_string_conversions.h" 8 #include "base/utf_string_conversions.h"
9 #include "chrome/browser/ui/browser.h"
10 #include "chrome/browser/ui/browser_tabstrip.h"
11 #include "chrome/test/base/in_process_browser_test.h"
12 #include "content/browser/renderer_host/render_view_host_impl.h" 9 #include "content/browser/renderer_host/render_view_host_impl.h"
13 #include "content/public/browser/notification_service.h" 10 #include "content/public/browser/notification_service.h"
14 #include "content/public/browser/notification_types.h" 11 #include "content/public/browser/notification_types.h"
15 #include "content/public/browser/render_widget_host_view.h" 12 #include "content/public/browser/render_widget_host_view.h"
16 #include "content/public/browser/web_contents.h" 13 #include "content/public/browser/web_contents.h"
17 #include "content/public/test/test_utils.h" 14 #include "content/public/test/test_utils.h"
15 #include "content/test/content_browser_test.h"
16 #include "content/test/content_browser_test_utils.h"
17 #include "content/shell/shell.h"
18 18
19 #if defined(OS_WIN) 19 #if defined(OS_WIN)
20 #include <atlbase.h> 20 #include <atlbase.h>
21 #include <atlcom.h> 21 #include <atlcom.h>
22 #include "ui/base/win/atl_module.h" 22 #include "ui/base/win/atl_module.h"
23 #endif 23 #endif
24 24
25 using content::AccessibilityNodeData; 25 namespace content {
26 using content::OpenURLParams;
27 using content::RenderViewHostImpl;
28 using content::RenderWidgetHostImpl;
29 using content::Referrer;
30 26
31 namespace { 27 class CrossPlatformAccessibilityBrowserTest : public ContentBrowserTest {
32
33 class CrossPlatformAccessibilityBrowserTest : public InProcessBrowserTest {
34 public: 28 public:
35 CrossPlatformAccessibilityBrowserTest() {} 29 CrossPlatformAccessibilityBrowserTest() {}
36 30
37 // Tell the renderer to send an accessibility tree, then wait for the 31 // Tell the renderer to send an accessibility tree, then wait for the
38 // notification that it's been received. 32 // notification that it's been received.
39 const AccessibilityNodeData& GetAccessibilityNodeDataTree( 33 const AccessibilityNodeData& GetAccessibilityNodeDataTree(
40 AccessibilityMode accessibility_mode = AccessibilityModeComplete) { 34 AccessibilityMode accessibility_mode = AccessibilityModeComplete) {
41 content::WindowedNotificationObserver tree_updated_observer( 35 WindowedNotificationObserver tree_updated_observer(
42 content::NOTIFICATION_RENDER_VIEW_HOST_ACCESSIBILITY_TREE_UPDATED, 36 NOTIFICATION_RENDER_VIEW_HOST_ACCESSIBILITY_TREE_UPDATED,
43 content::NotificationService::AllSources()); 37 NotificationService::AllSources());
44 content::RenderWidgetHostView* host_view = 38 RenderWidgetHostView* host_view =
45 chrome::GetActiveWebContents(browser())->GetRenderWidgetHostView(); 39 shell()->web_contents()->GetRenderWidgetHostView();
46 RenderWidgetHostImpl* host = 40 RenderWidgetHostImpl* host =
47 RenderWidgetHostImpl::From(host_view->GetRenderWidgetHost()); 41 RenderWidgetHostImpl::From(host_view->GetRenderWidgetHost());
48 RenderViewHostImpl* view_host = static_cast<RenderViewHostImpl*>(host); 42 RenderViewHostImpl* view_host = static_cast<RenderViewHostImpl*>(host);
49 view_host->set_save_accessibility_tree_for_testing(true); 43 view_host->set_save_accessibility_tree_for_testing(true);
50 view_host->SetAccessibilityMode(accessibility_mode); 44 view_host->SetAccessibilityMode(accessibility_mode);
51 tree_updated_observer.Wait(); 45 tree_updated_observer.Wait();
52 return view_host->accessibility_tree_for_testing(); 46 return view_host->accessibility_tree_for_testing();
53 } 47 }
54 48
55 // Make sure each node in the tree has an unique id. 49 // Make sure each node in the tree has an unique id.
56 void RecursiveAssertUniqueIds( 50 void RecursiveAssertUniqueIds(
57 const AccessibilityNodeData& node, base::hash_set<int>* ids) { 51 const AccessibilityNodeData& node, base::hash_set<int>* ids) {
58 ASSERT_TRUE(ids->find(node.id) == ids->end()); 52 ASSERT_TRUE(ids->find(node.id) == ids->end());
59 ids->insert(node.id); 53 ids->insert(node.id);
60 for (size_t i = 0; i < node.children.size(); i++) 54 for (size_t i = 0; i < node.children.size(); i++)
61 RecursiveAssertUniqueIds(node.children[i], ids); 55 RecursiveAssertUniqueIds(node.children[i], ids);
62 } 56 }
63 57
64 // InProcessBrowserTest 58 // ContentBrowserTest
65 void SetUpInProcessBrowserTestFixture(); 59 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE;
66 void TearDownInProcessBrowserTestFixture(); 60 virtual void TearDownInProcessBrowserTestFixture() OVERRIDE;
67 61
68 protected: 62 protected:
69 std::string GetAttr(const AccessibilityNodeData& node, 63 std::string GetAttr(const AccessibilityNodeData& node,
70 const AccessibilityNodeData::StringAttribute attr); 64 const AccessibilityNodeData::StringAttribute attr);
71 int GetIntAttr(const AccessibilityNodeData& node, 65 int GetIntAttr(const AccessibilityNodeData& node,
72 const AccessibilityNodeData::IntAttribute attr); 66 const AccessibilityNodeData::IntAttribute attr);
73 bool GetBoolAttr(const AccessibilityNodeData& node, 67 bool GetBoolAttr(const AccessibilityNodeData& node,
74 const AccessibilityNodeData::BoolAttribute attr); 68 const AccessibilityNodeData::BoolAttribute attr);
75 }; 69 };
76 70
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 IN_PROC_BROWSER_TEST_F(CrossPlatformAccessibilityBrowserTest, 125 IN_PROC_BROWSER_TEST_F(CrossPlatformAccessibilityBrowserTest,
132 DISABLED_WebpageAccessibility) { 126 DISABLED_WebpageAccessibility) {
133 // Create a data url and load it. 127 // Create a data url and load it.
134 const char url_str[] = 128 const char url_str[] =
135 "data:text/html," 129 "data:text/html,"
136 "<!doctype html>" 130 "<!doctype html>"
137 "<html><head><title>Accessibility Test</title></head>" 131 "<html><head><title>Accessibility Test</title></head>"
138 "<body><input type='button' value='push' /><input type='checkbox' />" 132 "<body><input type='button' value='push' /><input type='checkbox' />"
139 "</body></html>"; 133 "</body></html>";
140 GURL url(url_str); 134 GURL url(url_str);
141 browser()->OpenURL(OpenURLParams( 135 NavigateToURL(shell(), url);
142 url, Referrer(), CURRENT_TAB, content::PAGE_TRANSITION_TYPED, false));
143 const AccessibilityNodeData& tree = GetAccessibilityNodeDataTree(); 136 const AccessibilityNodeData& tree = GetAccessibilityNodeDataTree();
144 137
145 // Check properties of the root element of the tree. 138 // Check properties of the root element of the tree.
146 EXPECT_STREQ(url_str, 139 EXPECT_STREQ(url_str,
147 GetAttr(tree, AccessibilityNodeData::ATTR_DOC_URL).c_str()); 140 GetAttr(tree, AccessibilityNodeData::ATTR_DOC_URL).c_str());
148 EXPECT_STREQ( 141 EXPECT_STREQ(
149 "Accessibility Test", 142 "Accessibility Test",
150 GetAttr(tree, AccessibilityNodeData::ATTR_DOC_TITLE).c_str()); 143 GetAttr(tree, AccessibilityNodeData::ATTR_DOC_TITLE).c_str());
151 EXPECT_STREQ( 144 EXPECT_STREQ(
152 "html", GetAttr(tree, AccessibilityNodeData::ATTR_DOC_DOCTYPE).c_str()); 145 "html", GetAttr(tree, AccessibilityNodeData::ATTR_DOC_DOCTYPE).c_str());
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 IN_PROC_BROWSER_TEST_F(CrossPlatformAccessibilityBrowserTest, 192 IN_PROC_BROWSER_TEST_F(CrossPlatformAccessibilityBrowserTest,
200 UnselectedEditableTextAccessibility) { 193 UnselectedEditableTextAccessibility) {
201 // Create a data url and load it. 194 // Create a data url and load it.
202 const char url_str[] = 195 const char url_str[] =
203 "data:text/html," 196 "data:text/html,"
204 "<!doctype html>" 197 "<!doctype html>"
205 "<body>" 198 "<body>"
206 "<input value=\"Hello, world.\"/>" 199 "<input value=\"Hello, world.\"/>"
207 "</body></html>"; 200 "</body></html>";
208 GURL url(url_str); 201 GURL url(url_str);
209 browser()->OpenURL(OpenURLParams( 202 NavigateToURL(shell(), url);
210 url, Referrer(), CURRENT_TAB, content::PAGE_TRANSITION_TYPED, false));
211 203
212 const AccessibilityNodeData& tree = GetAccessibilityNodeDataTree(); 204 const AccessibilityNodeData& tree = GetAccessibilityNodeDataTree();
213 ASSERT_EQ(1U, tree.children.size()); 205 ASSERT_EQ(1U, tree.children.size());
214 const AccessibilityNodeData& body = tree.children[0]; 206 const AccessibilityNodeData& body = tree.children[0];
215 ASSERT_EQ(1U, body.children.size()); 207 ASSERT_EQ(1U, body.children.size());
216 const AccessibilityNodeData& text = body.children[0]; 208 const AccessibilityNodeData& text = body.children[0];
217 EXPECT_EQ(AccessibilityNodeData::ROLE_TEXT_FIELD, text.role); 209 EXPECT_EQ(AccessibilityNodeData::ROLE_TEXT_FIELD, text.role);
218 EXPECT_STREQ( 210 EXPECT_STREQ(
219 "input", GetAttr(text, AccessibilityNodeData::ATTR_HTML_TAG).c_str()); 211 "input", GetAttr(text, AccessibilityNodeData::ATTR_HTML_TAG).c_str());
220 EXPECT_EQ(0, GetIntAttr(text, AccessibilityNodeData::ATTR_TEXT_SEL_START)); 212 EXPECT_EQ(0, GetIntAttr(text, AccessibilityNodeData::ATTR_TEXT_SEL_START));
221 EXPECT_EQ(0, GetIntAttr(text, AccessibilityNodeData::ATTR_TEXT_SEL_END)); 213 EXPECT_EQ(0, GetIntAttr(text, AccessibilityNodeData::ATTR_TEXT_SEL_END));
222 EXPECT_STREQ("Hello, world.", UTF16ToUTF8(text.value).c_str()); 214 EXPECT_STREQ("Hello, world.", UTF16ToUTF8(text.value).c_str());
223 215
224 // TODO(dmazzoni): as soon as more accessibility code is cross-platform, 216 // TODO(dmazzoni): as soon as more accessibility code is cross-platform,
225 // this code should test that the accessible info is dynamically updated 217 // this code should test that the accessible info is dynamically updated
226 // if the selection or value changes. 218 // if the selection or value changes.
227 } 219 }
228 220
229 IN_PROC_BROWSER_TEST_F(CrossPlatformAccessibilityBrowserTest, 221 IN_PROC_BROWSER_TEST_F(CrossPlatformAccessibilityBrowserTest,
230 SelectedEditableTextAccessibility) { 222 SelectedEditableTextAccessibility) {
231 // Create a data url and load it. 223 // Create a data url and load it.
232 const char url_str[] = 224 const char url_str[] =
233 "data:text/html," 225 "data:text/html,"
234 "<!doctype html>" 226 "<!doctype html>"
235 "<body onload=\"document.body.children[0].select();\">" 227 "<body onload=\"document.body.children[0].select();\">"
236 "<input value=\"Hello, world.\"/>" 228 "<input value=\"Hello, world.\"/>"
237 "</body></html>"; 229 "</body></html>";
238 GURL url(url_str); 230 GURL url(url_str);
239 browser()->OpenURL(OpenURLParams( 231 NavigateToURL(shell(), url);
240 url, Referrer(), CURRENT_TAB, content::PAGE_TRANSITION_TYPED, false));
241 232
242 const AccessibilityNodeData& tree = GetAccessibilityNodeDataTree(); 233 const AccessibilityNodeData& tree = GetAccessibilityNodeDataTree();
243 ASSERT_EQ(1U, tree.children.size()); 234 ASSERT_EQ(1U, tree.children.size());
244 const AccessibilityNodeData& body = tree.children[0]; 235 const AccessibilityNodeData& body = tree.children[0];
245 ASSERT_EQ(1U, body.children.size()); 236 ASSERT_EQ(1U, body.children.size());
246 const AccessibilityNodeData& text = body.children[0]; 237 const AccessibilityNodeData& text = body.children[0];
247 EXPECT_EQ(AccessibilityNodeData::ROLE_TEXT_FIELD, text.role); 238 EXPECT_EQ(AccessibilityNodeData::ROLE_TEXT_FIELD, text.role);
248 EXPECT_STREQ( 239 EXPECT_STREQ(
249 "input", GetAttr(text, AccessibilityNodeData::ATTR_HTML_TAG).c_str()); 240 "input", GetAttr(text, AccessibilityNodeData::ATTR_HTML_TAG).c_str());
250 EXPECT_EQ(0, GetIntAttr(text, AccessibilityNodeData::ATTR_TEXT_SEL_START)); 241 EXPECT_EQ(0, GetIntAttr(text, AccessibilityNodeData::ATTR_TEXT_SEL_START));
251 EXPECT_EQ(13, GetIntAttr(text, AccessibilityNodeData::ATTR_TEXT_SEL_END)); 242 EXPECT_EQ(13, GetIntAttr(text, AccessibilityNodeData::ATTR_TEXT_SEL_END));
252 EXPECT_STREQ("Hello, world.", UTF16ToUTF8(text.value).c_str()); 243 EXPECT_STREQ("Hello, world.", UTF16ToUTF8(text.value).c_str());
253 } 244 }
254 245
255 IN_PROC_BROWSER_TEST_F(CrossPlatformAccessibilityBrowserTest, 246 IN_PROC_BROWSER_TEST_F(CrossPlatformAccessibilityBrowserTest,
256 MultipleInheritanceAccessibility) { 247 MultipleInheritanceAccessibility) {
257 // In a WebKit accessibility render tree for a table, each cell is a 248 // In a WebKit accessibility render tree for a table, each cell is a
258 // child of both a row and a column, so it appears to use multiple 249 // child of both a row and a column, so it appears to use multiple
259 // inheritance. Make sure that the AccessibilityNodeDataObject tree only 250 // inheritance. Make sure that the AccessibilityNodeDataObject tree only
260 // keeps one copy of each cell, and uses an indirect child id for the 251 // keeps one copy of each cell, and uses an indirect child id for the
261 // additional reference to it. 252 // additional reference to it.
262 const char url_str[] = 253 const char url_str[] =
263 "data:text/html," 254 "data:text/html,"
264 "<!doctype html>" 255 "<!doctype html>"
265 "<table border=1><tr><td>1</td><td>2</td></tr></table>"; 256 "<table border=1><tr><td>1</td><td>2</td></tr></table>";
266 GURL url(url_str); 257 GURL url(url_str);
267 browser()->OpenURL(OpenURLParams( 258 NavigateToURL(shell(), url);
268 url, Referrer(), CURRENT_TAB, content::PAGE_TRANSITION_TYPED, false));
269 259
270 const AccessibilityNodeData& tree = GetAccessibilityNodeDataTree(); 260 const AccessibilityNodeData& tree = GetAccessibilityNodeDataTree();
271 ASSERT_EQ(1U, tree.children.size()); 261 ASSERT_EQ(1U, tree.children.size());
272 const AccessibilityNodeData& table = tree.children[0]; 262 const AccessibilityNodeData& table = tree.children[0];
273 EXPECT_EQ(AccessibilityNodeData::ROLE_TABLE, table.role); 263 EXPECT_EQ(AccessibilityNodeData::ROLE_TABLE, table.role);
274 const AccessibilityNodeData& row = table.children[0]; 264 const AccessibilityNodeData& row = table.children[0];
275 EXPECT_EQ(AccessibilityNodeData::ROLE_ROW, row.role); 265 EXPECT_EQ(AccessibilityNodeData::ROLE_ROW, row.role);
276 const AccessibilityNodeData& cell1 = row.children[0]; 266 const AccessibilityNodeData& cell1 = row.children[0];
277 EXPECT_EQ(AccessibilityNodeData::ROLE_CELL, cell1.role); 267 EXPECT_EQ(AccessibilityNodeData::ROLE_CELL, cell1.role);
278 const AccessibilityNodeData& cell2 = row.children[1]; 268 const AccessibilityNodeData& cell2 = row.children[1];
(...skipping 18 matching lines...) Expand all
297 const char url_str[] = 287 const char url_str[] =
298 "data:text/html," 288 "data:text/html,"
299 "<!doctype html>" 289 "<!doctype html>"
300 "<script>\n" 290 "<script>\n"
301 " document.writeln('<q><section></section></q><q><li>');\n" 291 " document.writeln('<q><section></section></q><q><li>');\n"
302 " setTimeout(function() {\n" 292 " setTimeout(function() {\n"
303 " document.close();\n" 293 " document.close();\n"
304 " }, 1);\n" 294 " }, 1);\n"
305 "</script>"; 295 "</script>";
306 GURL url(url_str); 296 GURL url(url_str);
307 browser()->OpenURL(OpenURLParams( 297 NavigateToURL(shell(), url);
308 url, Referrer(), CURRENT_TAB, content::PAGE_TRANSITION_TYPED, false));
309 298
310 const AccessibilityNodeData& tree = GetAccessibilityNodeDataTree(); 299 const AccessibilityNodeData& tree = GetAccessibilityNodeDataTree();
311 base::hash_set<int> ids; 300 base::hash_set<int> ids;
312 RecursiveAssertUniqueIds(tree, &ids); 301 RecursiveAssertUniqueIds(tree, &ids);
313 } 302 }
314 303
315 IN_PROC_BROWSER_TEST_F(CrossPlatformAccessibilityBrowserTest, 304 IN_PROC_BROWSER_TEST_F(CrossPlatformAccessibilityBrowserTest,
316 IframeAccessibility) { 305 IframeAccessibility) {
317 // Create a data url and load it. 306 // Create a data url and load it.
318 const char url_str[] = 307 const char url_str[] =
319 "data:text/html," 308 "data:text/html,"
320 "<!doctype html><html><body>" 309 "<!doctype html><html><body>"
321 "<button>Button 1</button>" 310 "<button>Button 1</button>"
322 "<iframe src='data:text/html," 311 "<iframe src='data:text/html,"
323 "<!doctype html><html><body><button>Button 2</button></body></html>" 312 "<!doctype html><html><body><button>Button 2</button></body></html>"
324 "'></iframe>" 313 "'></iframe>"
325 "<button>Button 3</button>" 314 "<button>Button 3</button>"
326 "</body></html>"; 315 "</body></html>";
327 GURL url(url_str); 316 GURL url(url_str);
328 browser()->OpenURL(OpenURLParams( 317 NavigateToURL(shell(), url);
329 url, Referrer(), CURRENT_TAB, content::PAGE_TRANSITION_TYPED, false));
330 318
331 const AccessibilityNodeData& tree = GetAccessibilityNodeDataTree(); 319 const AccessibilityNodeData& tree = GetAccessibilityNodeDataTree();
332 ASSERT_EQ(1U, tree.children.size()); 320 ASSERT_EQ(1U, tree.children.size());
333 const AccessibilityNodeData& body = tree.children[0]; 321 const AccessibilityNodeData& body = tree.children[0];
334 ASSERT_EQ(3U, body.children.size()); 322 ASSERT_EQ(3U, body.children.size());
335 323
336 const AccessibilityNodeData& button1 = body.children[0]; 324 const AccessibilityNodeData& button1 = body.children[0];
337 EXPECT_EQ(AccessibilityNodeData::ROLE_BUTTON, button1.role); 325 EXPECT_EQ(AccessibilityNodeData::ROLE_BUTTON, button1.role);
338 EXPECT_STREQ("Button 1", UTF16ToUTF8(button1.name).c_str()); 326 EXPECT_STREQ("Button 1", UTF16ToUTF8(button1.name).c_str());
339 327
(...skipping 25 matching lines...) Expand all
365 IN_PROC_BROWSER_TEST_F(CrossPlatformAccessibilityBrowserTest, 353 IN_PROC_BROWSER_TEST_F(CrossPlatformAccessibilityBrowserTest,
366 DuplicateChildrenAccessibility) { 354 DuplicateChildrenAccessibility) {
367 // Here's another html snippet where WebKit has a parent node containing 355 // Here's another html snippet where WebKit has a parent node containing
368 // two duplicate child nodes. Instead of checking the exact output, just 356 // two duplicate child nodes. Instead of checking the exact output, just
369 // make sure that no id is reused in the resulting tree. 357 // make sure that no id is reused in the resulting tree.
370 const char url_str[] = 358 const char url_str[] =
371 "data:text/html," 359 "data:text/html,"
372 "<!doctype html>" 360 "<!doctype html>"
373 "<em><code ><h4 ></em>"; 361 "<em><code ><h4 ></em>";
374 GURL url(url_str); 362 GURL url(url_str);
375 browser()->OpenURL(OpenURLParams( 363 NavigateToURL(shell(), url);
376 url, Referrer(), CURRENT_TAB, content::PAGE_TRANSITION_TYPED, false));
377 364
378 const AccessibilityNodeData& tree = GetAccessibilityNodeDataTree(); 365 const AccessibilityNodeData& tree = GetAccessibilityNodeDataTree();
379 base::hash_set<int> ids; 366 base::hash_set<int> ids;
380 RecursiveAssertUniqueIds(tree, &ids); 367 RecursiveAssertUniqueIds(tree, &ids);
381 } 368 }
382 369
383 IN_PROC_BROWSER_TEST_F(CrossPlatformAccessibilityBrowserTest, 370 IN_PROC_BROWSER_TEST_F(CrossPlatformAccessibilityBrowserTest,
384 TableSpan) { 371 TableSpan) {
385 // +---+---+---+ 372 // +---+---+---+
386 // | 1 | 2 | 373 // | 1 | 2 |
387 // +---+---+---+ 374 // +---+---+---+
388 // | 3 | 4 | 375 // | 3 | 4 |
389 // +---+---+---+ 376 // +---+---+---+
390 377
391 const char url_str[] = 378 const char url_str[] =
392 "data:text/html," 379 "data:text/html,"
393 "<!doctype html>" 380 "<!doctype html>"
394 "<table border=1>" 381 "<table border=1>"
395 " <tr>" 382 " <tr>"
396 " <td colspan=2>1</td><td>2</td>" 383 " <td colspan=2>1</td><td>2</td>"
397 " </tr>" 384 " </tr>"
398 " <tr>" 385 " <tr>"
399 " <td>3</td><td colspan=2>4</td>" 386 " <td>3</td><td colspan=2>4</td>"
400 " </tr>" 387 " </tr>"
401 "</table>"; 388 "</table>";
402 GURL url(url_str); 389 GURL url(url_str);
403 browser()->OpenURL(OpenURLParams( 390 NavigateToURL(shell(), url);
404 url, Referrer(), CURRENT_TAB, content::PAGE_TRANSITION_TYPED, false));
405 391
406 const AccessibilityNodeData& tree = GetAccessibilityNodeDataTree(); 392 const AccessibilityNodeData& tree = GetAccessibilityNodeDataTree();
407 const AccessibilityNodeData& table = tree.children[0]; 393 const AccessibilityNodeData& table = tree.children[0];
408 EXPECT_EQ(AccessibilityNodeData::ROLE_TABLE, table.role); 394 EXPECT_EQ(AccessibilityNodeData::ROLE_TABLE, table.role);
409 ASSERT_GE(table.children.size(), 5U); 395 ASSERT_GE(table.children.size(), 5U);
410 EXPECT_EQ(AccessibilityNodeData::ROLE_ROW, table.children[0].role); 396 EXPECT_EQ(AccessibilityNodeData::ROLE_ROW, table.children[0].role);
411 EXPECT_EQ(AccessibilityNodeData::ROLE_ROW, table.children[1].role); 397 EXPECT_EQ(AccessibilityNodeData::ROLE_ROW, table.children[1].role);
412 EXPECT_EQ(AccessibilityNodeData::ROLE_COLUMN, table.children[2].role); 398 EXPECT_EQ(AccessibilityNodeData::ROLE_COLUMN, table.children[2].role);
413 EXPECT_EQ(AccessibilityNodeData::ROLE_COLUMN, table.children[3].role); 399 EXPECT_EQ(AccessibilityNodeData::ROLE_COLUMN, table.children[3].role);
414 EXPECT_EQ(AccessibilityNodeData::ROLE_COLUMN, table.children[4].role); 400 EXPECT_EQ(AccessibilityNodeData::ROLE_COLUMN, table.children[4].role);
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
453 439
454 IN_PROC_BROWSER_TEST_F(CrossPlatformAccessibilityBrowserTest, 440 IN_PROC_BROWSER_TEST_F(CrossPlatformAccessibilityBrowserTest,
455 WritableElement) { 441 WritableElement) {
456 const char url_str[] = 442 const char url_str[] =
457 "data:text/html," 443 "data:text/html,"
458 "<!doctype html>" 444 "<!doctype html>"
459 "<div role='textbox' tabindex=0>" 445 "<div role='textbox' tabindex=0>"
460 " Some text" 446 " Some text"
461 "</div>"; 447 "</div>";
462 GURL url(url_str); 448 GURL url(url_str);
463 browser()->OpenURL(OpenURLParams( 449 NavigateToURL(shell(), url);
464 url, Referrer(), CURRENT_TAB, content::PAGE_TRANSITION_TYPED, false));
465 const AccessibilityNodeData& tree = GetAccessibilityNodeDataTree(); 450 const AccessibilityNodeData& tree = GetAccessibilityNodeDataTree();
466 451
467 ASSERT_EQ(1U, tree.children.size()); 452 ASSERT_EQ(1U, tree.children.size());
468 const AccessibilityNodeData& textbox = tree.children[0]; 453 const AccessibilityNodeData& textbox = tree.children[0];
469 454
470 EXPECT_EQ( 455 EXPECT_EQ(
471 true, GetBoolAttr(textbox, AccessibilityNodeData::ATTR_CAN_SET_VALUE)); 456 true, GetBoolAttr(textbox, AccessibilityNodeData::ATTR_CAN_SET_VALUE));
472 } 457 }
473 458
474 } // namespace 459 } // namespace content
OLDNEW
« no previous file with comments | « chrome/chrome_tests.gypi ('k') | content/browser/accessibility/dump_accessibility_tree_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698