summaryrefslogtreecommitdiffstats
path: root/chrome/browser/accessibility
diff options
context:
space:
mode:
authorthakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-12-04 00:45:08 +0000
committerthakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-12-04 00:45:08 +0000
commit107248107d7b38e9614e99972b3a99385005956e (patch)
treef160374426a89785f58604d28a0f42a56b2cb905 /chrome/browser/accessibility
parent8c191828b46d933eeed942d9b5b633b1c121ccc6 (diff)
downloadchromium_src-107248107d7b38e9614e99972b3a99385005956e.zip
chromium_src-107248107d7b38e9614e99972b3a99385005956e.tar.gz
chromium_src-107248107d7b38e9614e99972b3a99385005956e.tar.bz2
Revert r112885 and follow-up r112886.
They caused http://crbug.com/106304 BUG=99629 TEST=none TBR=dmazzoni Review URL: http://codereview.chromium.org/8793001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@112913 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/accessibility')
-rw-r--r--chrome/browser/accessibility/browser_accessibility_win_unittest.cc167
1 files changed, 0 insertions, 167 deletions
diff --git a/chrome/browser/accessibility/browser_accessibility_win_unittest.cc b/chrome/browser/accessibility/browser_accessibility_win_unittest.cc
index f049ca7..52872a4 100644
--- a/chrome/browser/accessibility/browser_accessibility_win_unittest.cc
+++ b/chrome/browser/accessibility/browser_accessibility_win_unittest.cc
@@ -366,173 +366,6 @@ TEST_F(BrowserAccessibilityTest, TestTextBoundaries) {
ASSERT_EQ(0, CountedBrowserAccessibility::global_obj_count_);
}
-TEST_F(BrowserAccessibilityTest, TestSimpleHypertext) {
- WebAccessibility text1;
- text1.id = 11;
- text1.role = WebAccessibility::ROLE_STATIC_TEXT;
- text1.state = 0;
- text1.name = L"One two three.";
-
- WebAccessibility text2;
- text2.id = 12;
- text2.role = WebAccessibility::ROLE_STATIC_TEXT;
- text2.state = 0;
- text2.name = L" Four five six.";
-
- WebAccessibility root;
- root.id = 1;
- root.role = WebAccessibility::ROLE_DOCUMENT;
- root.state = 0;
- root.children.push_back(text1);
- root.children.push_back(text2);
-
- CountedBrowserAccessibility::global_obj_count_ = 0;
- BrowserAccessibilityManager* manager = BrowserAccessibilityManager::Create(
- GetDesktopWindow(), root, NULL,
- new CountedBrowserAccessibilityFactory());
- ASSERT_EQ(3, CountedBrowserAccessibility::global_obj_count_);
-
- BrowserAccessibilityWin* root_obj =
- manager->GetRoot()->toBrowserAccessibilityWin();
-
- BSTR text;
-
- long text_len;
- ASSERT_EQ(S_OK, root_obj->get_nCharacters(&text_len));
-
- ASSERT_EQ(S_OK, root_obj->get_text(0, text_len, &text));
- EXPECT_EQ(text, text1.name + text2.name);
- SysFreeString(text);
-
- long hyperlink_count;
- ASSERT_EQ(S_OK, root_obj->get_nHyperlinks(&hyperlink_count));
- EXPECT_EQ(0, hyperlink_count);
-
- base::win::ScopedComPtr<IAccessibleHyperlink> hyperlink;
- EXPECT_EQ(E_INVALIDARG, root_obj->get_hyperlink(-1, hyperlink.Receive()));
- EXPECT_EQ(E_INVALIDARG, root_obj->get_hyperlink(0, hyperlink.Receive()));
- EXPECT_EQ(E_INVALIDARG, root_obj->get_hyperlink(28, hyperlink.Receive()));
- EXPECT_EQ(E_INVALIDARG, root_obj->get_hyperlink(29, hyperlink.Receive()));
-
- long hyperlink_index;
- EXPECT_EQ(E_FAIL, root_obj->get_hyperlinkIndex(0, &hyperlink_index));
- EXPECT_EQ(-1, hyperlink_index);
- EXPECT_EQ(E_FAIL, root_obj->get_hyperlinkIndex(28, &hyperlink_index));
- EXPECT_EQ(-1, hyperlink_index);
- EXPECT_EQ(E_INVALIDARG, root_obj->get_hyperlinkIndex(-1, &hyperlink_index));
- EXPECT_EQ(-1, hyperlink_index);
- EXPECT_EQ(E_INVALIDARG, root_obj->get_hyperlinkIndex(29, &hyperlink_index));
- EXPECT_EQ(-1, hyperlink_index);
-
- // Delete the manager and test that all BrowserAccessibility instances are
- // deleted.
- delete manager;
- ASSERT_EQ(0, CountedBrowserAccessibility::global_obj_count_);
-}
-
-TEST_F(BrowserAccessibilityTest, TestComplexHypertext) {
- WebAccessibility text1;
- text1.id = 11;
- text1.role = WebAccessibility::ROLE_STATIC_TEXT;
- text1.state = 0;
- text1.name = L"One two three.";
-
- WebAccessibility text2;
- text2.id = 12;
- text2.role = WebAccessibility::ROLE_STATIC_TEXT;
- text2.state = 0;
- text2.name = L" Four five six.";
-
- WebAccessibility button1, button1_text;
- button1.id = 13;
- button1_text.id = 15;
- button1_text.name = L"red";
- button1.role = WebAccessibility::ROLE_BUTTON;
- button1_text.role = WebAccessibility::ROLE_STATIC_TEXT;
- button1.state = 0;
- button1.children.push_back(button1_text);
-
- WebAccessibility link1, link1_text;
- link1.id = 14;
- link1_text.id = 16;
- link1_text.name = L"blue";
- link1.role = WebAccessibility::ROLE_LINK;
- link1_text.role = WebAccessibility::ROLE_STATIC_TEXT;
- link1.state = 0;
- link1.children.push_back(link1_text);
-
- WebAccessibility root;
- root.id = 1;
- root.role = WebAccessibility::ROLE_DOCUMENT;
- root.state = 0;
- root.children.push_back(text1);
- root.children.push_back(button1);
- root.children.push_back(text2);
- root.children.push_back(link1);
-
- CountedBrowserAccessibility::global_obj_count_ = 0;
- BrowserAccessibilityManager* manager = BrowserAccessibilityManager::Create(
- GetDesktopWindow(), root, NULL,
- new CountedBrowserAccessibilityFactory());
- ASSERT_EQ(7, CountedBrowserAccessibility::global_obj_count_);
-
- BrowserAccessibilityWin* root_obj =
- manager->GetRoot()->toBrowserAccessibilityWin();
-
- BSTR text;
-
- long text_len;
- ASSERT_EQ(S_OK, root_obj->get_nCharacters(&text_len));
-
- ASSERT_EQ(S_OK, root_obj->get_text(0, text_len, &text));
- const string16 embed = BrowserAccessibilityWin::kEmbeddedCharacter;
- EXPECT_EQ(text, text1.name + embed + text2.name + embed);
- SysFreeString(text);
-
- long hyperlink_count;
- ASSERT_EQ(S_OK, root_obj->get_nHyperlinks(&hyperlink_count));
- EXPECT_EQ(2, hyperlink_count);
-
- base::win::ScopedComPtr<IAccessibleHyperlink> hyperlink;
- base::win::ScopedComPtr<IAccessibleText> hypertext;
- EXPECT_EQ(E_INVALIDARG, root_obj->get_hyperlink(-1, hyperlink.Receive()));
- EXPECT_EQ(E_INVALIDARG, root_obj->get_hyperlink(2, hyperlink.Receive()));
- EXPECT_EQ(E_INVALIDARG, root_obj->get_hyperlink(28, hyperlink.Receive()));
-
- EXPECT_EQ(S_OK, root_obj->get_hyperlink(0, hyperlink.Receive()));
- EXPECT_EQ(S_OK,
- hyperlink.QueryInterface<IAccessibleText>(hypertext.Receive()));
- EXPECT_EQ(S_OK, hypertext->get_text(0, 3, &text));
- EXPECT_EQ(text, string16(L"red"));
- SysFreeString(text);
- hyperlink.Release();
- hypertext.Release();
-
- EXPECT_EQ(S_OK, root_obj->get_hyperlink(1, hyperlink.Receive()));
- EXPECT_EQ(S_OK,
- hyperlink.QueryInterface<IAccessibleText>(hypertext.Receive()));
- EXPECT_EQ(S_OK, hypertext->get_text(0, 4, &text));
- EXPECT_EQ(text, string16(L"blue"));
- SysFreeString(text);
- hyperlink.Release();
- hypertext.Release();
-
- long hyperlink_index;
- EXPECT_EQ(E_FAIL, root_obj->get_hyperlinkIndex(0, &hyperlink_index));
- EXPECT_EQ(-1, hyperlink_index);
- EXPECT_EQ(E_FAIL, root_obj->get_hyperlinkIndex(28, &hyperlink_index));
- EXPECT_EQ(-1, hyperlink_index);
- EXPECT_EQ(S_OK, root_obj->get_hyperlinkIndex(14, &hyperlink_index));
- EXPECT_EQ(0, hyperlink_index);
- EXPECT_EQ(S_OK, root_obj->get_hyperlinkIndex(30, &hyperlink_index));
- EXPECT_EQ(1, hyperlink_index);
-
- // Delete the manager and test that all BrowserAccessibility instances are
- // deleted.
- delete manager;
- ASSERT_EQ(0, CountedBrowserAccessibility::global_obj_count_);
-}
-
TEST_F(BrowserAccessibilityTest, TestScrollingLogic) {
#define SCROLL BrowserAccessibility::ComputeBestScrollOffset