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

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

Issue 7648055: Add DCHECK to BrowserAccessibilityManager::Remove to detect undefined behavoir that may lead to a... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 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
« no previous file with comments | « no previous file | content/browser/accessibility/browser_accessibility_manager.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) 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 580 matching lines...) Expand 10 before | Expand all | Expand 10 after
591 // Save for later comparison. 591 // Save for later comparison.
592 BrowserAccessibility* acc1_2 = manager->GetFromRendererID(1001); 592 BrowserAccessibility* acc1_2 = manager->GetFromRendererID(1001);
593 593
594 // Verify the root has not changed. 594 // Verify the root has not changed.
595 EXPECT_EQ(root, manager->GetRoot()); 595 EXPECT_EQ(root, manager->GetRoot());
596 596
597 // And the proper child remains. 597 // And the proper child remains.
598 EXPECT_EQ(WebAccessibility::ROLE_TEXT_FIELD, acc1_2->role()); 598 EXPECT_EQ(WebAccessibility::ROLE_TEXT_FIELD, acc1_2->role());
599 EXPECT_EQ(1001, acc1_2->renderer_id()); 599 EXPECT_EQ(1001, acc1_2->renderer_id());
600 600
601 // Tree with a child button.
602 WebAccessibility tree2_1;
603 tree2_1.id = 1000;
604 tree2_1.role = WebAccessibility::ROLE_WEB_AREA;
605
606 WebAccessibility tree2_2;
607 tree2_2.id = 1001;
608 tree2_2.role = WebAccessibility::ROLE_BUTTON;
609
610 tree2_1.children.push_back(tree2_2);
611
612 msg->acc_obj = tree2_1;
613
614 // Fire another load complete.
615 manager->OnAccessibilityNotifications(params);
616
617 BrowserAccessibility* acc2_2 = manager->GetFromRendererID(1001);
618
619 // Verify the root has not changed.
620 EXPECT_EQ(root, manager->GetRoot());
621
622 // And the proper child remains.
623 EXPECT_EQ(WebAccessibility::ROLE_BUTTON, acc2_2->role());
624 EXPECT_EQ(1001, acc2_2->renderer_id());
625
626 // Verify we don't reuse objects that have changed roles.
David Tseng 2011/08/16 23:32:52 Shouldn't this be the only assertion removed from
Chris Guillory 2011/08/17 00:00:43 Done. I've also updated tree2 to not attempt to ch
627 EXPECT_NE(acc1_2, acc2_2);
628
629 // Ensure we properly cleaned up. 601 // Ensure we properly cleaned up.
630 manager.reset(); 602 manager.reset();
631 ASSERT_EQ(0, CountedBrowserAccessibility::global_obj_count_); 603 ASSERT_EQ(0, CountedBrowserAccessibility::global_obj_count_);
632 } 604 }
OLDNEW
« no previous file with comments | « no previous file | content/browser/accessibility/browser_accessibility_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698