summaryrefslogtreecommitdiffstats
path: root/chrome/browser/accessibility
diff options
context:
space:
mode:
authorctguil@chromium.org <ctguil@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-08-17 23:12:07 +0000
committerctguil@chromium.org <ctguil@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-08-17 23:12:07 +0000
commitd3540c23e13dc77e8c89054bcadc7d56eeb497de (patch)
tree2da591b26d57ef6fc7965ed2733356fbe7485d46 /chrome/browser/accessibility
parent55b23a0e5ac8b7e29ba56892d302286856b7f98a (diff)
downloadchromium_src-d3540c23e13dc77e8c89054bcadc7d56eeb497de.zip
chromium_src-d3540c23e13dc77e8c89054bcadc7d56eeb497de.tar.gz
chromium_src-d3540c23e13dc77e8c89054bcadc7d56eeb497de.tar.bz2
Add DCHECK to BrowserAccessibilityManager::Remove to detect undefined behavoir that may lead to a crash.
- Remove logic BrowserAccessibilityManagerTest.TestCreateEmptyDocument that attempts to change an accessibility object's role. - Update BrowserAccessibilityTest to have unique ids for all nodes. BUG=92716 Test=none Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=97076 Review URL: http://codereview.chromium.org/7648055 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@97235 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/accessibility')
-rw-r--r--chrome/browser/accessibility/browser_accessibility_mac_unittest.mm3
-rw-r--r--chrome/browser/accessibility/browser_accessibility_manager_unittest.cc11
2 files changed, 7 insertions, 7 deletions
diff --git a/chrome/browser/accessibility/browser_accessibility_mac_unittest.mm b/chrome/browser/accessibility/browser_accessibility_mac_unittest.mm
index fee3fd7..2b1d7f8 100644
--- a/chrome/browser/accessibility/browser_accessibility_mac_unittest.mm
+++ b/chrome/browser/accessibility/browser_accessibility_mac_unittest.mm
@@ -50,6 +50,7 @@ class BrowserAccessibilityTest : public CocoaTest {
virtual void SetUp() {
CocoaTest::SetUp();
WebAccessibility root;
+ root.id = 1000;
root.location.set_width(500);
root.location.set_height(100);
root.role = WebAccessibility::ROLE_WEB_AREA;
@@ -57,12 +58,14 @@ class BrowserAccessibilityTest : public CocoaTest {
ASCIIToUTF16("HelpText");
WebAccessibility child1;
+ child1.id = 1001;
child1.name = ASCIIToUTF16("Child1");
child1.location.set_width(250);
child1.location.set_height(100);
child1.role = WebAccessibility::ROLE_BUTTON;
WebAccessibility child2;
+ child2.id = 1002;
child2.location.set_x(250);
child2.location.set_width(250);
child2.location.set_height(100);
diff --git a/chrome/browser/accessibility/browser_accessibility_manager_unittest.cc b/chrome/browser/accessibility/browser_accessibility_manager_unittest.cc
index 3bbc2d3..51691ec 100644
--- a/chrome/browser/accessibility/browser_accessibility_manager_unittest.cc
+++ b/chrome/browser/accessibility/browser_accessibility_manager_unittest.cc
@@ -604,7 +604,7 @@ TEST(BrowserAccessibilityManagerTest, TestCreateEmptyDocument) {
tree2_1.role = WebAccessibility::ROLE_WEB_AREA;
WebAccessibility tree2_2;
- tree2_2.id = 1001;
+ tree2_2.id = 1002;
tree2_2.role = WebAccessibility::ROLE_BUTTON;
tree2_1.children.push_back(tree2_2);
@@ -614,17 +614,14 @@ TEST(BrowserAccessibilityManagerTest, TestCreateEmptyDocument) {
// Fire another load complete.
manager->OnAccessibilityNotifications(params);
- BrowserAccessibility* acc2_2 = manager->GetFromRendererID(1001);
+ BrowserAccessibility* acc2_2 = manager->GetFromRendererID(1002);
// Verify the root has not changed.
EXPECT_EQ(root, manager->GetRoot());
- // And the proper child remains.
+ // And the new child exists.
EXPECT_EQ(WebAccessibility::ROLE_BUTTON, acc2_2->role());
- EXPECT_EQ(1001, acc2_2->renderer_id());
-
- // Verify we don't reuse objects that have changed roles.
- EXPECT_NE(acc1_2, acc2_2);
+ EXPECT_EQ(1002, acc2_2->renderer_id());
// Ensure we properly cleaned up.
manager.reset();