| 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 "content/browser/accessibility/browser_accessibility_win.h" | 5 #include "content/browser/accessibility/browser_accessibility_win.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <memory> | 9 #include <memory> |
| 10 | 10 |
| (...skipping 1840 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1851 hr = ax_link->get_attributes(0, &start_offset, &end_offset, | 1851 hr = ax_link->get_attributes(0, &start_offset, &end_offset, |
| 1852 text_attributes.Receive()); | 1852 text_attributes.Receive()); |
| 1853 EXPECT_EQ(S_OK, hr); | 1853 EXPECT_EQ(S_OK, hr); |
| 1854 EXPECT_EQ(0, start_offset); | 1854 EXPECT_EQ(0, start_offset); |
| 1855 EXPECT_EQ(3, end_offset); | 1855 EXPECT_EQ(3, end_offset); |
| 1856 EXPECT_NE(base::string16::npos, | 1856 EXPECT_NE(base::string16::npos, |
| 1857 base::string16(text_attributes).find(L"font-family:Helvetica")); | 1857 base::string16(text_attributes).find(L"font-family:Helvetica")); |
| 1858 EXPECT_NE(base::string16::npos, | 1858 EXPECT_NE(base::string16::npos, |
| 1859 base::string16(text_attributes).find(L"font-weight:normal")); | 1859 base::string16(text_attributes).find(L"font-weight:normal")); |
| 1860 EXPECT_NE(base::string16::npos, | 1860 EXPECT_NE(base::string16::npos, |
| 1861 base::string16(text_attributes).find(L"font-style:underline")); | 1861 base::string16(text_attributes).find(L"font-style:normal")); |
| 1862 EXPECT_NE( |
| 1863 base::string16::npos, |
| 1864 base::string16(text_attributes).find(L"text-underline-style:solid")); |
| 1865 EXPECT_NE( |
| 1866 base::string16::npos, |
| 1867 base::string16(text_attributes).find(L"text-underline-type:single")); |
| 1862 text_attributes.Reset(); | 1868 text_attributes.Reset(); |
| 1863 | 1869 |
| 1864 hr = ax_link_text->get_attributes(2, &start_offset, &end_offset, | 1870 hr = ax_link_text->get_attributes(2, &start_offset, &end_offset, |
| 1865 text_attributes.Receive()); | 1871 text_attributes.Receive()); |
| 1866 EXPECT_EQ(S_OK, hr); | 1872 EXPECT_EQ(S_OK, hr); |
| 1867 EXPECT_EQ(0, start_offset); | 1873 EXPECT_EQ(0, start_offset); |
| 1868 EXPECT_EQ(3, end_offset); | 1874 EXPECT_EQ(3, end_offset); |
| 1869 EXPECT_NE(base::string16::npos, | 1875 EXPECT_NE(base::string16::npos, |
| 1870 base::string16(text_attributes).find(L"font-family:Helvetica")); | 1876 base::string16(text_attributes).find(L"font-family:Helvetica")); |
| 1871 EXPECT_NE(base::string16::npos, | 1877 EXPECT_NE(base::string16::npos, |
| 1872 base::string16(text_attributes).find(L"font-weight:normal")); | 1878 base::string16(text_attributes).find(L"font-weight:normal")); |
| 1873 EXPECT_NE(base::string16::npos, | 1879 EXPECT_NE(base::string16::npos, |
| 1874 base::string16(text_attributes).find(L"font-style:underline")); | 1880 base::string16(text_attributes).find(L"font-style:normal")); |
| 1881 EXPECT_NE( |
| 1882 base::string16::npos, |
| 1883 base::string16(text_attributes).find(L"text-underline-style:solid")); |
| 1884 EXPECT_NE( |
| 1885 base::string16::npos, |
| 1886 base::string16(text_attributes).find(L"text-underline-type:single")); |
| 1875 EXPECT_NE(base::string16::npos, | 1887 EXPECT_NE(base::string16::npos, |
| 1876 base::string16(text_attributes).find(L"invalid:spelling")); | 1888 base::string16(text_attributes).find(L"invalid:spelling")); |
| 1877 text_attributes.Reset(); | 1889 text_attributes.Reset(); |
| 1878 | 1890 |
| 1879 // Test the style of text_after. | 1891 // Test the style of text_after. |
| 1880 for (LONG offset = 8; offset < 15; ++offset) { | 1892 for (LONG offset = 8; offset < 15; ++offset) { |
| 1881 hr = ax_div->get_attributes(offset, &start_offset, &end_offset, | 1893 hr = ax_div->get_attributes(offset, &start_offset, &end_offset, |
| 1882 text_attributes.Receive()); | 1894 text_attributes.Receive()); |
| 1883 EXPECT_EQ(S_OK, hr); | 1895 EXPECT_EQ(S_OK, hr); |
| 1884 EXPECT_EQ(8, start_offset); | 1896 EXPECT_EQ(8, start_offset); |
| 1885 EXPECT_EQ(15, end_offset); | 1897 EXPECT_EQ(15, end_offset); |
| 1886 base::string16 attributes(text_attributes); | 1898 base::string16 attributes(text_attributes); |
| 1887 EXPECT_NE(base::string16::npos, attributes.find(L"font-family:Helvetica")); | 1899 EXPECT_NE(base::string16::npos, attributes.find(L"font-family:Helvetica")); |
| 1888 EXPECT_NE(base::string16::npos, attributes.find(L"font-weight:normal")); | 1900 EXPECT_NE(base::string16::npos, attributes.find(L"font-weight:normal")); |
| 1889 EXPECT_NE(base::string16::npos, attributes.find(L"font-style:normal")); | 1901 EXPECT_NE(base::string16::npos, attributes.find(L"font-style:normal")); |
| 1902 EXPECT_NE( |
| 1903 base::string16::npos, |
| 1904 base::string16(text_attributes).find(L"text-underline-style:none")); |
| 1905 EXPECT_NE( |
| 1906 base::string16::npos, |
| 1907 base::string16(text_attributes).find(L"text-underline-type:none")); |
| 1890 EXPECT_EQ(base::string16::npos, attributes.find(L"invalid:spelling")); | 1908 EXPECT_EQ(base::string16::npos, attributes.find(L"invalid:spelling")); |
| 1891 text_attributes.Reset(); | 1909 text_attributes.Reset(); |
| 1892 } | 1910 } |
| 1893 | 1911 |
| 1894 // Test the style of the static text nodes. | 1912 // Test the style of the static text nodes. |
| 1895 hr = ax_before->get_attributes(6, &start_offset, &end_offset, | 1913 hr = ax_before->get_attributes(6, &start_offset, &end_offset, |
| 1896 text_attributes.Receive()); | 1914 text_attributes.Receive()); |
| 1897 EXPECT_EQ(S_OK, hr); | 1915 EXPECT_EQ(S_OK, hr); |
| 1898 EXPECT_EQ(0, start_offset); | 1916 EXPECT_EQ(0, start_offset); |
| 1899 EXPECT_EQ(7, end_offset); | 1917 EXPECT_EQ(7, end_offset); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 1911 text_attributes.Receive()); | 1929 text_attributes.Receive()); |
| 1912 EXPECT_EQ(S_OK, hr); | 1930 EXPECT_EQ(S_OK, hr); |
| 1913 EXPECT_EQ(0, start_offset); | 1931 EXPECT_EQ(0, start_offset); |
| 1914 EXPECT_EQ(7, end_offset); | 1932 EXPECT_EQ(7, end_offset); |
| 1915 EXPECT_NE(base::string16::npos, | 1933 EXPECT_NE(base::string16::npos, |
| 1916 base::string16(text_attributes).find(L"font-family:Helvetica")); | 1934 base::string16(text_attributes).find(L"font-family:Helvetica")); |
| 1917 EXPECT_NE(base::string16::npos, | 1935 EXPECT_NE(base::string16::npos, |
| 1918 base::string16(text_attributes).find(L"font-weight:normal")); | 1936 base::string16(text_attributes).find(L"font-weight:normal")); |
| 1919 EXPECT_NE(base::string16::npos, | 1937 EXPECT_NE(base::string16::npos, |
| 1920 base::string16(text_attributes).find(L"font-style:normal")); | 1938 base::string16(text_attributes).find(L"font-style:normal")); |
| 1939 EXPECT_NE(base::string16::npos, |
| 1940 base::string16(text_attributes).find(L"text-underline-style:none")); |
| 1941 EXPECT_NE(base::string16::npos, |
| 1942 base::string16(text_attributes).find(L"text-underline-type:none")); |
| 1921 EXPECT_EQ(base::string16::npos, | 1943 EXPECT_EQ(base::string16::npos, |
| 1922 base::string16(text_attributes).find(L"invalid:spelling")); | 1944 base::string16(text_attributes).find(L"invalid:spelling")); |
| 1923 text_attributes.Reset(); | 1945 text_attributes.Reset(); |
| 1924 | 1946 |
| 1925 manager.reset(); | 1947 manager.reset(); |
| 1926 ASSERT_EQ(0, CountedBrowserAccessibility::num_instances()); | 1948 ASSERT_EQ(0, CountedBrowserAccessibility::num_instances()); |
| 1927 } | 1949 } |
| 1928 | 1950 |
| 1929 TEST_F(BrowserAccessibilityTest, TestMisspellingsInSimpleTextFields) { | 1951 TEST_F(BrowserAccessibilityTest, TestMisspellingsInSimpleTextFields) { |
| 1930 std::string value1("Testing ."); | 1952 std::string value1("Testing ."); |
| (...skipping 527 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2458 std::vector<AXEventNotificationDetails> events = {event}; | 2480 std::vector<AXEventNotificationDetails> events = {event}; |
| 2459 manager->OnAccessibilityEvents(events); | 2481 manager->OnAccessibilityEvents(events); |
| 2460 | 2482 |
| 2461 EXPECT_HRESULT_SUCCEEDED(ax_child1->get_nRelations(&n_relations)); | 2483 EXPECT_HRESULT_SUCCEEDED(ax_child1->get_nRelations(&n_relations)); |
| 2462 EXPECT_EQ(2, n_relations); | 2484 EXPECT_EQ(2, n_relations); |
| 2463 EXPECT_HRESULT_SUCCEEDED(ax_child2->get_nRelations(&n_relations)); | 2485 EXPECT_HRESULT_SUCCEEDED(ax_child2->get_nRelations(&n_relations)); |
| 2464 EXPECT_EQ(2, n_relations); | 2486 EXPECT_EQ(2, n_relations); |
| 2465 } | 2487 } |
| 2466 | 2488 |
| 2467 } // namespace content | 2489 } // namespace content |
| OLD | NEW |