OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "base/callback.h" | 5 #include "base/callback.h" |
6 #include "base/macros.h" | 6 #include "base/macros.h" |
7 #include "content/browser/web_contents/web_contents_impl.h" | 7 #include "content/browser/web_contents/web_contents_impl.h" |
8 #include "content/public/test/content_browser_test.h" | 8 #include "content/public/test/content_browser_test.h" |
9 #include "content/public/test/content_browser_test_utils.h" | 9 #include "content/public/test/content_browser_test_utils.h" |
10 #include "content/public/test/test_utils.h" | 10 #include "content/public/test/test_utils.h" |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 | 79 |
80 // Dump the whole tree if one of the assertions below fails | 80 // Dump the whole tree if one of the assertions below fails |
81 // to aid in debugging why it failed. | 81 // to aid in debugging why it failed. |
82 SCOPED_TRACE(waiter.snapshot().ToString()); | 82 SCOPED_TRACE(waiter.snapshot().ToString()); |
83 | 83 |
84 ui::AXTree tree(waiter.snapshot()); | 84 ui::AXTree tree(waiter.snapshot()); |
85 ui::AXNode* root = tree.root(); | 85 ui::AXNode* root = tree.root(); |
86 ASSERT_NE(nullptr, root); | 86 ASSERT_NE(nullptr, root); |
87 ASSERT_EQ(ui::AX_ROLE_ROOT_WEB_AREA, root->data().role); | 87 ASSERT_EQ(ui::AX_ROLE_ROOT_WEB_AREA, root->data().role); |
88 ui::AXNode* group = root->ChildAtIndex(0); | 88 ui::AXNode* group = root->ChildAtIndex(0); |
89 ASSERT_EQ(ui::AX_ROLE_GROUP, group->data().role); | 89 ASSERT_EQ(ui::AX_ROLE_GENERIC_CONTAINER, group->data().role); |
90 ui::AXNode* button = group->ChildAtIndex(0); | 90 ui::AXNode* button = group->ChildAtIndex(0); |
91 ASSERT_EQ(ui::AX_ROLE_BUTTON, button->data().role); | 91 ASSERT_EQ(ui::AX_ROLE_BUTTON, button->data().role); |
92 } | 92 } |
93 | 93 |
94 IN_PROC_BROWSER_TEST_F(SnapshotAXTreeBrowserTest, | 94 IN_PROC_BROWSER_TEST_F(SnapshotAXTreeBrowserTest, |
95 SnapshotAccessibilityTreeFromMultipleFrames) { | 95 SnapshotAccessibilityTreeFromMultipleFrames) { |
96 ASSERT_TRUE(embedded_test_server()->Start()); | 96 ASSERT_TRUE(embedded_test_server()->Start()); |
97 | 97 |
98 NavigateToURL(shell(), embedded_test_server()->GetURL( | 98 NavigateToURL(shell(), embedded_test_server()->GetURL( |
99 "/accessibility/snapshot/outer.html")); | 99 "/accessibility/snapshot/outer.html")); |
(...skipping 15 matching lines...) Expand all Loading... |
115 // Dump the whole tree if one of the assertions below fails | 115 // Dump the whole tree if one of the assertions below fails |
116 // to aid in debugging why it failed. | 116 // to aid in debugging why it failed. |
117 SCOPED_TRACE(waiter.snapshot().ToString()); | 117 SCOPED_TRACE(waiter.snapshot().ToString()); |
118 | 118 |
119 ui::AXTree tree(waiter.snapshot()); | 119 ui::AXTree tree(waiter.snapshot()); |
120 ui::AXNode* root = tree.root(); | 120 ui::AXNode* root = tree.root(); |
121 std::string dump; | 121 std::string dump; |
122 DumpRolesAndNamesAsText(root, 0, &dump); | 122 DumpRolesAndNamesAsText(root, 0, &dump); |
123 EXPECT_EQ( | 123 EXPECT_EQ( |
124 "rootWebArea\n" | 124 "rootWebArea\n" |
125 " group\n" | 125 " genericContainer\n" |
126 " button 'Before'\n" | 126 " button 'Before'\n" |
127 " iframe\n" | 127 " iframe\n" |
128 " rootWebArea\n" | 128 " rootWebArea\n" |
129 " pre\n" | 129 " pre\n" |
130 " staticText 'Alpha'\n" | 130 " staticText 'Alpha'\n" |
131 " button 'Middle'\n" | 131 " button 'Middle'\n" |
132 " iframe\n" | 132 " iframe\n" |
133 " rootWebArea\n" | 133 " rootWebArea\n" |
134 " group\n" | 134 " genericContainer\n" |
135 " button 'Inside Before'\n" | 135 " button 'Inside Before'\n" |
136 " iframe\n" | 136 " iframe\n" |
137 " rootWebArea\n" | 137 " rootWebArea\n" |
138 " button 'Inside After'\n" | 138 " button 'Inside After'\n" |
139 " button 'After'\n", | 139 " button 'After'\n", |
140 dump); | 140 dump); |
141 } | 141 } |
142 | 142 |
143 } // namespace content | 143 } // namespace content |
OLD | NEW |