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

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

Issue 8888034: Revert 113704 - Remove special casing for firing load completes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years 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 | « content/browser/accessibility/browser_accessibility_manager.cc ('k') | no next file » | 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) 2011 The Chromium Authors. All rights reserved. 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 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 "base/string16.h" 5 #include "base/string16.h"
6 #include "base/utf_string_conversions.h" 6 #include "base/utf_string_conversions.h"
7 #include "content/browser/accessibility/browser_accessibility.h" 7 #include "content/browser/accessibility/browser_accessibility.h"
8 #include "content/browser/accessibility/browser_accessibility_manager.h" 8 #include "content/browser/accessibility/browser_accessibility_manager.h"
9 #include "content/common/view_messages.h" 9 #include "content/common/view_messages.h"
10 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
(...skipping 576 matching lines...) Expand 10 before | Expand all | Expand 10 after
587 ViewHostMsg_AccessibilityNotification_Params* msg = &params[0]; 587 ViewHostMsg_AccessibilityNotification_Params* msg = &params[0];
588 msg->notification_type = ViewHostMsg_AccEvent::LOAD_COMPLETE; 588 msg->notification_type = ViewHostMsg_AccEvent::LOAD_COMPLETE;
589 msg->acc_tree = tree1_1; 589 msg->acc_tree = tree1_1;
590 msg->includes_children = true; 590 msg->includes_children = true;
591 msg->id = tree1_1.id; 591 msg->id = tree1_1.id;
592 manager->OnAccessibilityNotifications(params); 592 manager->OnAccessibilityNotifications(params);
593 593
594 // Save for later comparison. 594 // Save for later comparison.
595 BrowserAccessibility* acc1_2 = manager->GetFromRendererID(2); 595 BrowserAccessibility* acc1_2 = manager->GetFromRendererID(2);
596 596
597 // Verify the root has not changed. 597 // Verify the root has changed.
598 EXPECT_EQ(root, manager->GetRoot()); 598 EXPECT_NE(root, manager->GetRoot());
599 599
600 // And the proper child remains. 600 // And the proper child remains.
601 EXPECT_EQ(WebAccessibility::ROLE_TEXT_FIELD, acc1_2->role()); 601 EXPECT_EQ(WebAccessibility::ROLE_TEXT_FIELD, acc1_2->role());
602 EXPECT_EQ(2, acc1_2->renderer_id()); 602 EXPECT_EQ(2, acc1_2->renderer_id());
603 603
604 // Tree with a child button. 604 // Tree with a child button.
605 WebAccessibility tree2_1; 605 WebAccessibility tree2_1;
606 tree2_1.id = 1; 606 tree2_1.id = 1;
607 tree2_1.role = WebAccessibility::ROLE_ROOT_WEB_AREA; 607 tree2_1.role = WebAccessibility::ROLE_ROOT_WEB_AREA;
608 608
609 WebAccessibility tree2_2; 609 WebAccessibility tree2_2;
610 tree2_2.id = 3; 610 tree2_2.id = 3;
611 tree2_2.role = WebAccessibility::ROLE_BUTTON; 611 tree2_2.role = WebAccessibility::ROLE_BUTTON;
612 612
613 tree2_1.children.push_back(tree2_2); 613 tree2_1.children.push_back(tree2_2);
614 614
615 msg->acc_tree = tree2_1; 615 msg->acc_tree = tree2_1;
616 msg->includes_children = true; 616 msg->includes_children = true;
617 msg->id = tree2_1.id; 617 msg->id = tree2_1.id;
618 618
619 // Fire another load complete. 619 // Fire another load complete.
620 manager->OnAccessibilityNotifications(params); 620 manager->OnAccessibilityNotifications(params);
621 621
622 BrowserAccessibility* acc2_2 = manager->GetFromRendererID(3); 622 BrowserAccessibility* acc2_2 = manager->GetFromRendererID(3);
623 623
624 // Verify the root has not changed. 624 // Verify the root has changed.
625 EXPECT_EQ(root, manager->GetRoot()); 625 EXPECT_NE(root, manager->GetRoot());
626 626
627 // And the new child exists. 627 // And the new child exists.
628 EXPECT_EQ(WebAccessibility::ROLE_BUTTON, acc2_2->role()); 628 EXPECT_EQ(WebAccessibility::ROLE_BUTTON, acc2_2->role());
629 EXPECT_EQ(3, acc2_2->renderer_id()); 629 EXPECT_EQ(3, acc2_2->renderer_id());
630 630
631 // Ensure we properly cleaned up. 631 // Ensure we properly cleaned up.
632 manager.reset(); 632 manager.reset();
633 ASSERT_EQ(0, CountedBrowserAccessibility::global_obj_count_); 633 ASSERT_EQ(0, CountedBrowserAccessibility::global_obj_count_);
634 } 634 }
OLDNEW
« no previous file with comments | « content/browser/accessibility/browser_accessibility_manager.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698