| 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 1587 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1598 32, CONTENTS_LENGTH, L"\"KHTML, like\"."); | 1598 32, CONTENTS_LENGTH, L"\"KHTML, like\"."); |
| 1599 | 1599 |
| 1600 // Test special offsets. | 1600 // Test special offsets. |
| 1601 CheckTextAtOffset(textarea_text, IA2_TEXT_OFFSET_LENGTH, | 1601 CheckTextAtOffset(textarea_text, IA2_TEXT_OFFSET_LENGTH, |
| 1602 IA2_TEXT_BOUNDARY_LINE, 32, CONTENTS_LENGTH, L"\"KHTML, like\"."); | 1602 IA2_TEXT_BOUNDARY_LINE, 32, CONTENTS_LENGTH, L"\"KHTML, like\"."); |
| 1603 CheckTextAtOffset(textarea_text, IA2_TEXT_OFFSET_CARET, | 1603 CheckTextAtOffset(textarea_text, IA2_TEXT_OFFSET_CARET, |
| 1604 IA2_TEXT_BOUNDARY_LINE, 32, CONTENTS_LENGTH, L"\"KHTML, like\"."); | 1604 IA2_TEXT_BOUNDARY_LINE, 32, CONTENTS_LENGTH, L"\"KHTML, like\"."); |
| 1605 } | 1605 } |
| 1606 | 1606 |
| 1607 IN_PROC_BROWSER_TEST_F(AccessibilityWinBrowserTest, | 1607 IN_PROC_BROWSER_TEST_F(AccessibilityWinBrowserTest, |
| 1608 TestParagraphTextAtOffsetWithBoundaryLine) { |
| 1609 base::win::ScopedComPtr<IAccessibleText> paragraph_text; |
| 1610 SetUpSampleParagraph(¶graph_text); |
| 1611 |
| 1612 // There should be two lines in this paragraph. |
| 1613 const LONG newline_offset = 46; |
| 1614 LONG n_characters; |
| 1615 ASSERT_HRESULT_SUCCEEDED(paragraph_text->get_nCharacters(&n_characters)); |
| 1616 ASSERT_LT(0, n_characters); |
| 1617 ASSERT_LT(newline_offset, n_characters); |
| 1618 |
| 1619 for (LONG i = 0; i <= newline_offset; ++i) { |
| 1620 CheckTextAtOffset( |
| 1621 paragraph_text, i, IA2_TEXT_BOUNDARY_LINE, 0, newline_offset + 1, |
| 1622 L"Game theory is \"the study of \xFFFC of conflict and\n"); |
| 1623 } |
| 1624 |
| 1625 for (LONG i = newline_offset + 1; i < n_characters; ++i) { |
| 1626 CheckTextAtOffset( |
| 1627 paragraph_text, i, IA2_TEXT_BOUNDARY_LINE, newline_offset + 1, |
| 1628 n_characters, |
| 1629 L"cooperation between intelligent rational decision-makers.\""); |
| 1630 } |
| 1631 } |
| 1632 |
| 1633 IN_PROC_BROWSER_TEST_F(AccessibilityWinBrowserTest, |
| 1608 TestTextAtOffsetWithBoundaryAll) { | 1634 TestTextAtOffsetWithBoundaryAll) { |
| 1609 base::win::ScopedComPtr<IAccessibleText> input_text; | 1635 base::win::ScopedComPtr<IAccessibleText> input_text; |
| 1610 SetUpInputField(&input_text); | 1636 SetUpInputField(&input_text); |
| 1611 | 1637 |
| 1612 CheckTextAtOffset(input_text, 0, IA2_TEXT_BOUNDARY_ALL, | 1638 CheckTextAtOffset(input_text, 0, IA2_TEXT_BOUNDARY_ALL, |
| 1613 0, CONTENTS_LENGTH, base::SysUTF8ToWide(INPUT_CONTENTS)); | 1639 0, CONTENTS_LENGTH, base::SysUTF8ToWide(INPUT_CONTENTS)); |
| 1614 } | 1640 } |
| 1615 | 1641 |
| 1616 IN_PROC_BROWSER_TEST_F(AccessibilityWinBrowserTest, | 1642 IN_PROC_BROWSER_TEST_F(AccessibilityWinBrowserTest, |
| 1617 TestMultiLineTextAtOffsetWithBoundaryAll) { | 1643 TestMultiLineTextAtOffsetWithBoundaryAll) { |
| 1618 base::win::ScopedComPtr<IAccessibleText> textarea_text; | 1644 base::win::ScopedComPtr<IAccessibleText> textarea_text; |
| 1619 SetUpTextareaField(&textarea_text); | 1645 SetUpTextareaField(&textarea_text); |
| 1620 | 1646 |
| 1621 CheckTextAtOffset(textarea_text, CONTENTS_LENGTH - 1, IA2_TEXT_BOUNDARY_ALL, | 1647 CheckTextAtOffset(textarea_text, CONTENTS_LENGTH - 1, IA2_TEXT_BOUNDARY_ALL, |
| 1622 0, CONTENTS_LENGTH, base::SysUTF8ToWide(TEXTAREA_CONTENTS)); | 1648 0, CONTENTS_LENGTH, base::SysUTF8ToWide(TEXTAREA_CONTENTS)); |
| 1623 } | 1649 } |
| 1624 | 1650 |
| 1625 } // namespace content | 1651 } // namespace content |
| OLD | NEW |