| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <stddef.h> | 5 #include <stddef.h> |
| 6 #include <stdint.h> | 6 #include <stdint.h> |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 1646 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1657 base::win::ScopedComPtr<IAccessibleText> paragraph_text; | 1657 base::win::ScopedComPtr<IAccessibleText> paragraph_text; |
| 1658 SetUpSampleParagraph(¶graph_text); | 1658 SetUpSampleParagraph(¶graph_text); |
| 1659 base::string16 embedded_character( | 1659 base::string16 embedded_character( |
| 1660 1, BrowserAccessibilityWin::kEmbeddedCharacter); | 1660 1, BrowserAccessibilityWin::kEmbeddedCharacter); |
| 1661 std::vector<std::wstring> words; | 1661 std::vector<std::wstring> words; |
| 1662 words.push_back(L"Game "); | 1662 words.push_back(L"Game "); |
| 1663 words.push_back(L"theory "); | 1663 words.push_back(L"theory "); |
| 1664 words.push_back(L"is \""); | 1664 words.push_back(L"is \""); |
| 1665 words.push_back(L"the "); | 1665 words.push_back(L"the "); |
| 1666 words.push_back(L"study "); | 1666 words.push_back(L"study "); |
| 1667 words.push_back(L"of " + embedded_character + L' '); | 1667 words.push_back(L"of "); |
| 1668 words.push_back(embedded_character); |
| 1668 words.push_back(L"of "); | 1669 words.push_back(L"of "); |
| 1669 words.push_back(L"conflict "); | 1670 words.push_back(L"conflict "); |
| 1670 words.push_back(L"and\n"); | 1671 words.push_back(L"and\n"); |
| 1671 words.push_back(L"cooperation "); | 1672 words.push_back(L"cooperation "); |
| 1672 words.push_back(L"between "); | 1673 words.push_back(L"between "); |
| 1673 words.push_back(L"intelligent "); | 1674 words.push_back(L"intelligent "); |
| 1674 words.push_back(L"rational "); | 1675 words.push_back(L"rational "); |
| 1675 words.push_back(L"decision-"); | 1676 words.push_back(L"decision-"); |
| 1676 words.push_back(L"makers.\""); | 1677 words.push_back(L"makers.\""); |
| 1677 | 1678 |
| 1678 // Try to retrieve one word after another. | 1679 // Try to retrieve one word after another. |
| 1679 LONG word_start_offset = 0; | 1680 LONG word_start_offset = 0; |
| 1680 for (auto& word : words) { | 1681 for (auto& word : words) { |
| 1681 LONG word_end_offset = word_start_offset + word.size(); | 1682 LONG word_end_offset = word_start_offset + word.size(); |
| 1682 CheckTextAtOffset(paragraph_text, word_start_offset, IA2_TEXT_BOUNDARY_WORD, | 1683 CheckTextAtOffset(paragraph_text, word_start_offset, IA2_TEXT_BOUNDARY_WORD, |
| 1683 word_start_offset, word_end_offset, word); | 1684 word_start_offset, word_end_offset, word); |
| 1684 word_start_offset = word_end_offset; | 1685 word_start_offset = word_end_offset; |
| 1686 // If the word boundary is inside an embedded object, |word_end_offset| |
| 1687 // should be one past the embedded object character. To get to the start of |
| 1688 // the next word, we have to skip the space between the embedded object |
| 1689 // character and the next word. |
| 1690 if (word == embedded_character) |
| 1691 ++word_start_offset; |
| 1685 } | 1692 } |
| 1686 } | 1693 } |
| 1687 | 1694 |
| 1688 IN_PROC_BROWSER_TEST_F(AccessibilityWinBrowserTest, | 1695 IN_PROC_BROWSER_TEST_F(AccessibilityWinBrowserTest, |
| 1689 TestTextAtOffsetWithBoundarySentence) { | 1696 TestTextAtOffsetWithBoundarySentence) { |
| 1690 base::win::ScopedComPtr<IAccessibleText> input_text; | 1697 base::win::ScopedComPtr<IAccessibleText> input_text; |
| 1691 SetUpInputField(&input_text); | 1698 SetUpInputField(&input_text); |
| 1692 | 1699 |
| 1693 // Sentence navigation is not currently implemented. | 1700 // Sentence navigation is not currently implemented. |
| 1694 LONG start_offset = 0; | 1701 LONG start_offset = 0; |
| (...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1899 ASSERT_EQ(nullptr, manager->GetParentHWND()); | 1906 ASSERT_EQ(nullptr, manager->GetParentHWND()); |
| 1900 | 1907 |
| 1901 // Now add the RWHVA's window to the root window and ensure that we have | 1908 // Now add the RWHVA's window to the root window and ensure that we have |
| 1902 // an HWND for accessibility now. | 1909 // an HWND for accessibility now. |
| 1903 web_contents_view->GetNativeView()->AddChild( | 1910 web_contents_view->GetNativeView()->AddChild( |
| 1904 web_contents->GetRenderWidgetHostView()->GetNativeView()); | 1911 web_contents->GetRenderWidgetHostView()->GetNativeView()); |
| 1905 ASSERT_NE(nullptr, manager->GetParentHWND()); | 1912 ASSERT_NE(nullptr, manager->GetParentHWND()); |
| 1906 } | 1913 } |
| 1907 | 1914 |
| 1908 } // namespace content | 1915 } // namespace content |
| OLD | NEW |