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

Side by Side Diff: chrome/browser/accessibility_win_browsertest.cc

Issue 3435019: Store lower cased tag names withing webaccessibility. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 3 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
« no previous file with comments | « no previous file | chrome/browser/browser_accessibility_win.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 <atlbase.h> 5 #include <atlbase.h>
6 #include <vector> 6 #include <vector>
7 7
8 #include "base/scoped_comptr_win.h" 8 #include "base/scoped_comptr_win.h"
9 #include "chrome/browser/automation/ui_controls.h" 9 #include "chrome/browser/automation/ui_controls.h"
10 #include "chrome/browser/browser.h" 10 #include "chrome/browser/browser.h"
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after
340 "data:text/html,<html><head><title>Accessibility Win Test</title></head>" 340 "data:text/html,<html><head><title>Accessibility Win Test</title></head>"
341 "<body><input type='button' value='push' /><input type='checkbox' />" 341 "<body><input type='button' value='push' /><input type='checkbox' />"
342 "</body></html>"); 342 "</body></html>");
343 browser()->OpenURL(tree_url, GURL(), CURRENT_TAB, PageTransition::TYPED); 343 browser()->OpenURL(tree_url, GURL(), CURRENT_TAB, PageTransition::TYPED);
344 ui_test_utils::WaitForNotification( 344 ui_test_utils::WaitForNotification(
345 NotificationType::RENDER_VIEW_HOST_ACCESSIBILITY_TREE_UPDATED); 345 NotificationType::RENDER_VIEW_HOST_ACCESSIBILITY_TREE_UPDATED);
346 346
347 // Check the browser's copy of the renderer accessibility tree. 347 // Check the browser's copy of the renderer accessibility tree.
348 AccessibleChecker button_checker(L"push", ROLE_SYSTEM_PUSHBUTTON, L"push"); 348 AccessibleChecker button_checker(L"push", ROLE_SYSTEM_PUSHBUTTON, L"push");
349 AccessibleChecker checkbox_checker(L"", ROLE_SYSTEM_CHECKBUTTON, L""); 349 AccessibleChecker checkbox_checker(L"", ROLE_SYSTEM_CHECKBUTTON, L"");
350 AccessibleChecker body_checker(L"", L"BODY", L""); 350 AccessibleChecker body_checker(L"", L"body", L"");
351 AccessibleChecker document2_checker( 351 AccessibleChecker document2_checker(
352 L"Accessibility Win Test", ROLE_SYSTEM_DOCUMENT, L""); 352 L"Accessibility Win Test", ROLE_SYSTEM_DOCUMENT, L"");
353 body_checker.AppendExpectedChild(&button_checker); 353 body_checker.AppendExpectedChild(&button_checker);
354 body_checker.AppendExpectedChild(&checkbox_checker); 354 body_checker.AppendExpectedChild(&checkbox_checker);
355 document2_checker.AppendExpectedChild(&body_checker); 355 document2_checker.AppendExpectedChild(&body_checker);
356 document2_checker.CheckAccessible(GetRendererAccessible()); 356 document2_checker.CheckAccessible(GetRendererAccessible());
357 357
358 // Check that document accessible has a parent accessible. 358 // Check that document accessible has a parent accessible.
359 ScopedComPtr<IAccessible> document_accessible(GetRendererAccessible()); 359 ScopedComPtr<IAccessible> document_accessible(GetRendererAccessible());
360 ASSERT_NE(document_accessible.get(), reinterpret_cast<IAccessible*>(NULL)); 360 ASSERT_NE(document_accessible.get(), reinterpret_cast<IAccessible*>(NULL));
(...skipping 19 matching lines...) Expand all
380 GURL tree_url("data:text/html,<body><input type='checkbox' /></body>"); 380 GURL tree_url("data:text/html,<body><input type='checkbox' /></body>");
381 browser()->OpenURL(tree_url, GURL(), CURRENT_TAB, PageTransition::TYPED); 381 browser()->OpenURL(tree_url, GURL(), CURRENT_TAB, PageTransition::TYPED);
382 GetRendererAccessible(); 382 GetRendererAccessible();
383 ui_test_utils::WaitForNotification( 383 ui_test_utils::WaitForNotification(
384 NotificationType::RENDER_VIEW_HOST_ACCESSIBILITY_TREE_UPDATED); 384 NotificationType::RENDER_VIEW_HOST_ACCESSIBILITY_TREE_UPDATED);
385 385
386 // Check the browser's copy of the renderer accessibility tree. 386 // Check the browser's copy of the renderer accessibility tree.
387 AccessibleChecker checkbox_checker(L"", ROLE_SYSTEM_CHECKBUTTON, L""); 387 AccessibleChecker checkbox_checker(L"", ROLE_SYSTEM_CHECKBUTTON, L"");
388 checkbox_checker.SetExpectedState( 388 checkbox_checker.SetExpectedState(
389 STATE_SYSTEM_FOCUSABLE | STATE_SYSTEM_READONLY); 389 STATE_SYSTEM_FOCUSABLE | STATE_SYSTEM_READONLY);
390 AccessibleChecker body_checker(L"", L"BODY", L""); 390 AccessibleChecker body_checker(L"", L"body", L"");
391 AccessibleChecker document_checker(L"", ROLE_SYSTEM_DOCUMENT, L""); 391 AccessibleChecker document_checker(L"", ROLE_SYSTEM_DOCUMENT, L"");
392 body_checker.AppendExpectedChild(&checkbox_checker); 392 body_checker.AppendExpectedChild(&checkbox_checker);
393 document_checker.AppendExpectedChild(&body_checker); 393 document_checker.AppendExpectedChild(&body_checker);
394 document_checker.CheckAccessible(GetRendererAccessible()); 394 document_checker.CheckAccessible(GetRendererAccessible());
395 395
396 // Check the checkbox. 396 // Check the checkbox.
397 ExecuteScript(L"document.body.children[0].checked=true"); 397 ExecuteScript(L"document.body.children[0].checked=true");
398 ui_test_utils::WaitForNotification( 398 ui_test_utils::WaitForNotification(
399 NotificationType::RENDER_VIEW_HOST_ACCESSIBILITY_TREE_UPDATED); 399 NotificationType::RENDER_VIEW_HOST_ACCESSIBILITY_TREE_UPDATED);
400 400
401 // Check that the accessibility tree of the browser has been updated. 401 // Check that the accessibility tree of the browser has been updated.
402 checkbox_checker.SetExpectedState( 402 checkbox_checker.SetExpectedState(
403 STATE_SYSTEM_CHECKED | STATE_SYSTEM_FOCUSABLE | STATE_SYSTEM_READONLY); 403 STATE_SYSTEM_CHECKED | STATE_SYSTEM_FOCUSABLE | STATE_SYSTEM_READONLY);
404 document_checker.CheckAccessible(GetRendererAccessible()); 404 document_checker.CheckAccessible(GetRendererAccessible());
405 } 405 }
406 406
407 IN_PROC_BROWSER_TEST_F(AccessibilityWinBrowserTest, 407 IN_PROC_BROWSER_TEST_F(AccessibilityWinBrowserTest,
408 TestNotificationChildrenChanged) { 408 TestNotificationChildrenChanged) {
409 // The aria-help attribute causes the node to be in the accessibility tree. 409 // The aria-help attribute causes the node to be in the accessibility tree.
410 GURL tree_url( 410 GURL tree_url(
411 "data:text/html,<body aria-help='body'></body>"); 411 "data:text/html,<body aria-help='body'></body>");
412 browser()->OpenURL(tree_url, GURL(), CURRENT_TAB, PageTransition::TYPED); 412 browser()->OpenURL(tree_url, GURL(), CURRENT_TAB, PageTransition::TYPED);
413 GetRendererAccessible(); 413 GetRendererAccessible();
414 ui_test_utils::WaitForNotification( 414 ui_test_utils::WaitForNotification(
415 NotificationType::RENDER_VIEW_HOST_ACCESSIBILITY_TREE_UPDATED); 415 NotificationType::RENDER_VIEW_HOST_ACCESSIBILITY_TREE_UPDATED);
416 416
417 // Check the browser's copy of the renderer accessibility tree. 417 // Check the browser's copy of the renderer accessibility tree.
418 AccessibleChecker body_checker(L"", L"BODY", L""); 418 AccessibleChecker body_checker(L"", L"body", L"");
419 AccessibleChecker document_checker(L"", ROLE_SYSTEM_DOCUMENT, L""); 419 AccessibleChecker document_checker(L"", ROLE_SYSTEM_DOCUMENT, L"");
420 document_checker.AppendExpectedChild(&body_checker); 420 document_checker.AppendExpectedChild(&body_checker);
421 document_checker.CheckAccessible(GetRendererAccessible()); 421 document_checker.CheckAccessible(GetRendererAccessible());
422 422
423 // Change the children of the document body. 423 // Change the children of the document body.
424 ExecuteScript(L"document.body.innerHTML='<b>new text</b>'"); 424 ExecuteScript(L"document.body.innerHTML='<b>new text</b>'");
425 ui_test_utils::WaitForNotification( 425 ui_test_utils::WaitForNotification(
426 NotificationType::RENDER_VIEW_HOST_ACCESSIBILITY_TREE_UPDATED); 426 NotificationType::RENDER_VIEW_HOST_ACCESSIBILITY_TREE_UPDATED);
427 427
428 // Check that the accessibility tree of the browser has been updated. 428 // Check that the accessibility tree of the browser has been updated.
(...skipping 15 matching lines...) Expand all
444 TestNotificationValueChanged) { 444 TestNotificationValueChanged) {
445 GURL tree_url("data:text/html,<body><input type='text' value='old value'/>" 445 GURL tree_url("data:text/html,<body><input type='text' value='old value'/>"
446 "</body>"); 446 "</body>");
447 browser()->OpenURL(tree_url, GURL(), CURRENT_TAB, PageTransition::TYPED); 447 browser()->OpenURL(tree_url, GURL(), CURRENT_TAB, PageTransition::TYPED);
448 GetRendererAccessible(); 448 GetRendererAccessible();
449 ui_test_utils::WaitForNotification( 449 ui_test_utils::WaitForNotification(
450 NotificationType::RENDER_VIEW_HOST_ACCESSIBILITY_TREE_UPDATED); 450 NotificationType::RENDER_VIEW_HOST_ACCESSIBILITY_TREE_UPDATED);
451 451
452 // Check the browser's copy of the renderer accessibility tree. 452 // Check the browser's copy of the renderer accessibility tree.
453 AccessibleChecker static_text_checker(L"", ROLE_SYSTEM_TEXT, L"old value"); 453 AccessibleChecker static_text_checker(L"", ROLE_SYSTEM_TEXT, L"old value");
454 AccessibleChecker text_field_div_checker(L"", L"DIV", L""); 454 AccessibleChecker text_field_div_checker(L"", L"div", L"");
455 AccessibleChecker text_field_checker(L"", ROLE_SYSTEM_TEXT, L"old value"); 455 AccessibleChecker text_field_checker(L"", ROLE_SYSTEM_TEXT, L"old value");
456 text_field_checker.SetExpectedState(STATE_SYSTEM_FOCUSABLE); 456 text_field_checker.SetExpectedState(STATE_SYSTEM_FOCUSABLE);
457 AccessibleChecker body_checker(L"", L"BODY", L""); 457 AccessibleChecker body_checker(L"", L"body", L"");
458 AccessibleChecker document_checker(L"", ROLE_SYSTEM_DOCUMENT, L""); 458 AccessibleChecker document_checker(L"", ROLE_SYSTEM_DOCUMENT, L"");
459 text_field_div_checker.AppendExpectedChild(&static_text_checker); 459 text_field_div_checker.AppendExpectedChild(&static_text_checker);
460 text_field_checker.AppendExpectedChild(&text_field_div_checker); 460 text_field_checker.AppendExpectedChild(&text_field_div_checker);
461 body_checker.AppendExpectedChild(&text_field_checker); 461 body_checker.AppendExpectedChild(&text_field_checker);
462 document_checker.AppendExpectedChild(&body_checker); 462 document_checker.AppendExpectedChild(&body_checker);
463 document_checker.CheckAccessible(GetRendererAccessible()); 463 document_checker.CheckAccessible(GetRendererAccessible());
464 464
465 // Set the value of the text control 465 // Set the value of the text control
466 ExecuteScript(L"document.body.children[0].value='new value'"); 466 ExecuteScript(L"document.body.children[0].value='new value'");
467 ui_test_utils::WaitForNotification( 467 ui_test_utils::WaitForNotification(
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
530 // If pointer comparison fails resort to the exhuasive search that can use 530 // If pointer comparison fails resort to the exhuasive search that can use
531 // IAccessible2::get_uniqueID for equality comparison. 531 // IAccessible2::get_uniqueID for equality comparison.
532 if (!found) { 532 if (!found) {
533 AccessibleContainsAccessible( 533 AccessibleContainsAccessible(
534 browser_accessible, document_accessible2, &found); 534 browser_accessible, document_accessible2, &found);
535 } 535 }
536 536
537 ASSERT_EQ(found, true); 537 ASSERT_EQ(found, true);
538 } 538 }
539 } // namespace. 539 } // namespace.
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/browser_accessibility_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698