| 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 <stdint.h> | 5 #include <stdint.h> |
| 6 | 6 |
| 7 #include "base/macros.h" | 7 #include "base/macros.h" |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
| 10 #include "base/win/scoped_bstr.h" | 10 #include "base/win/scoped_bstr.h" |
| (...skipping 1844 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1855 new_root_variant, new_root_dispatch.Receive()); | 1855 new_root_variant, new_root_dispatch.Receive()); |
| 1856 EXPECT_EQ(S_OK, hr); | 1856 EXPECT_EQ(S_OK, hr); |
| 1857 | 1857 |
| 1858 base::win::ScopedVariant new_child_variant(-child_unique_id_2); | 1858 base::win::ScopedVariant new_child_variant(-child_unique_id_2); |
| 1859 base::win::ScopedComPtr<IDispatch> new_child_dispatch; | 1859 base::win::ScopedComPtr<IDispatch> new_child_dispatch; |
| 1860 hr = ToBrowserAccessibilityWin(root)->get_accChild( | 1860 hr = ToBrowserAccessibilityWin(root)->get_accChild( |
| 1861 new_child_variant, new_child_dispatch.Receive()); | 1861 new_child_variant, new_child_dispatch.Receive()); |
| 1862 EXPECT_EQ(S_OK, hr); | 1862 EXPECT_EQ(S_OK, hr); |
| 1863 } | 1863 } |
| 1864 | 1864 |
| 1865 TEST_F(BrowserAccessibilityTest, AccChildOnlyReturnsDescendants) { |
| 1866 ui::AXNodeData root_node; |
| 1867 root_node.id = 1; |
| 1868 root_node.role = ui::AX_ROLE_ROOT_WEB_AREA; |
| 1869 |
| 1870 ui::AXNodeData child_node; |
| 1871 child_node.id = 2; |
| 1872 root_node.child_ids.push_back(2); |
| 1873 |
| 1874 scoped_ptr<BrowserAccessibilityManagerWin> manager( |
| 1875 new BrowserAccessibilityManagerWin( |
| 1876 MakeAXTreeUpdate(root_node, child_node), |
| 1877 nullptr, |
| 1878 new CountedBrowserAccessibilityFactory())); |
| 1879 |
| 1880 BrowserAccessibility* root = manager->GetRoot(); |
| 1881 BrowserAccessibility* child = root->PlatformGetChild(0); |
| 1882 |
| 1883 base::win::ScopedVariant root_unique_id_variant(-root->unique_id()); |
| 1884 base::win::ScopedComPtr<IDispatch> result; |
| 1885 EXPECT_EQ(E_INVALIDARG, ToBrowserAccessibilityWin(child)->get_accChild( |
| 1886 root_unique_id_variant, result.Receive())); |
| 1887 |
| 1888 base::win::ScopedVariant child_unique_id_variant(-child->unique_id()); |
| 1889 EXPECT_EQ(S_OK, ToBrowserAccessibilityWin(root)->get_accChild( |
| 1890 child_unique_id_variant, result.Receive())); |
| 1891 } |
| 1892 |
| 1865 } // namespace content | 1893 } // namespace content |
| OLD | NEW |