OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 <set> | 5 #include <set> |
6 #include <string> | 6 #include <string> |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/strings/string16.h" | 10 #include "base/strings/string16.h" |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 | 143 |
144 return concatenated; | 144 return concatenated; |
145 } | 145 } |
146 }; | 146 }; |
147 | 147 |
148 IN_PROC_BROWSER_TEST_F(AndroidGranularityMovementBrowserTest, | 148 IN_PROC_BROWSER_TEST_F(AndroidGranularityMovementBrowserTest, |
149 NavigateByCharacters) { | 149 NavigateByCharacters) { |
150 GURL url("data:text/html," | 150 GURL url("data:text/html," |
151 "<body>" | 151 "<body>" |
152 "<p>One, two, three!</p>" | 152 "<p>One, two, three!</p>" |
153 "<p>" | |
154 "<button aria-label='Seven, eight, nine!'>Four, five, six!</button>" | 153 "<button aria-label='Seven, eight, nine!'>Four, five, six!</button>" |
155 "</p>" | |
156 "</body></html>"); | 154 "</body></html>"); |
157 BrowserAccessibility* root = LoadUrlAndGetAccessibilityRoot(url); | 155 BrowserAccessibility* root = LoadUrlAndGetAccessibilityRoot(url); |
158 ASSERT_EQ(2U, root->PlatformChildCount()); | 156 ASSERT_EQ(2U, root->PlatformChildCount()); |
159 BrowserAccessibility* para = root->PlatformGetChild(0); | 157 BrowserAccessibility* para = root->PlatformGetChild(0); |
160 ASSERT_EQ(0U, para->PlatformChildCount()); | 158 ASSERT_EQ(0U, para->PlatformChildCount()); |
161 BrowserAccessibility* button_container = root->PlatformGetChild(1); | 159 BrowserAccessibility* button_container = root->PlatformGetChild(1); |
162 ASSERT_EQ(1U, button_container->PlatformChildCount()); | 160 ASSERT_EQ(1U, button_container->PlatformChildCount()); |
163 BrowserAccessibility* button = button_container->PlatformGetChild(0); | 161 BrowserAccessibility* button = button_container->PlatformGetChild(0); |
164 ASSERT_EQ(0U, button->PlatformChildCount()); | 162 ASSERT_EQ(0U, button->PlatformChildCount()); |
165 | 163 |
166 ASSERT_EQ( | 164 ASSERT_EQ( |
167 base::ASCIIToUTF16("'O', 'n', 'e', ',', ' ', 't', 'w', 'o', " | 165 base::ASCIIToUTF16("'O', 'n', 'e', ',', ' ', 't', 'w', 'o', " |
168 "',', ' ', 't', 'h', 'r', 'e', 'e', '!'"), | 166 "',', ' ', 't', 'h', 'r', 'e', 'e', '!'"), |
169 TraverseNodeAtGranularity(para, GRANULARITY_CHARACTER)); | 167 TraverseNodeAtGranularity(para, GRANULARITY_CHARACTER)); |
170 ASSERT_EQ( | 168 ASSERT_EQ( |
171 base::ASCIIToUTF16("'S', 'e', 'v', 'e', 'n', ',', ' ', 'e', 'i', 'g', " | 169 base::ASCIIToUTF16("'S', 'e', 'v', 'e', 'n', ',', ' ', 'e', 'i', 'g', " |
172 "'h', 't', ',', ' ', 'n', 'i', 'n', 'e', '!'"), | 170 "'h', 't', ',', ' ', 'n', 'i', 'n', 'e', '!'"), |
173 TraverseNodeAtGranularity(button, GRANULARITY_CHARACTER)); | 171 TraverseNodeAtGranularity(button, GRANULARITY_CHARACTER)); |
174 } | 172 } |
175 | 173 |
176 IN_PROC_BROWSER_TEST_F(AndroidGranularityMovementBrowserTest, | 174 IN_PROC_BROWSER_TEST_F(AndroidGranularityMovementBrowserTest, |
177 NavigateByWords) { | 175 NavigateByWords) { |
178 GURL url("data:text/html," | 176 GURL url("data:text/html," |
179 "<body>" | 177 "<body>" |
180 "<p>One, two, three!</p>" | 178 "<p>One, two, three!</p>" |
181 "<p>" | |
182 "<button aria-label='Seven, eight, nine!'>Four, five, six!</button>" | 179 "<button aria-label='Seven, eight, nine!'>Four, five, six!</button>" |
183 "</p>" | |
184 "</body></html>"); | 180 "</body></html>"); |
185 BrowserAccessibility* root = LoadUrlAndGetAccessibilityRoot(url); | 181 BrowserAccessibility* root = LoadUrlAndGetAccessibilityRoot(url); |
186 ASSERT_EQ(2U, root->PlatformChildCount()); | 182 ASSERT_EQ(2U, root->PlatformChildCount()); |
187 BrowserAccessibility* para = root->PlatformGetChild(0); | 183 BrowserAccessibility* para = root->PlatformGetChild(0); |
188 ASSERT_EQ(0U, para->PlatformChildCount()); | 184 ASSERT_EQ(0U, para->PlatformChildCount()); |
189 BrowserAccessibility* button_container = root->PlatformGetChild(1); | 185 BrowserAccessibility* button_container = root->PlatformGetChild(1); |
190 ASSERT_EQ(1U, button_container->PlatformChildCount()); | 186 ASSERT_EQ(1U, button_container->PlatformChildCount()); |
191 BrowserAccessibility* button = button_container->PlatformGetChild(0); | 187 BrowserAccessibility* button = button_container->PlatformGetChild(0); |
192 ASSERT_EQ(0U, button->PlatformChildCount()); | 188 ASSERT_EQ(0U, button->PlatformChildCount()); |
193 | 189 |
(...skipping 12 matching lines...) Expand all Loading... |
206 BrowserAccessibility* root = LoadUrlAndGetAccessibilityRoot(url); | 202 BrowserAccessibility* root = LoadUrlAndGetAccessibilityRoot(url); |
207 ASSERT_EQ(1U, root->PlatformChildCount()); | 203 ASSERT_EQ(1U, root->PlatformChildCount()); |
208 BrowserAccessibility* pre = root->PlatformGetChild(0); | 204 BrowserAccessibility* pre = root->PlatformGetChild(0); |
209 ASSERT_EQ(0U, pre->PlatformChildCount()); | 205 ASSERT_EQ(0U, pre->PlatformChildCount()); |
210 | 206 |
211 ASSERT_EQ(base::ASCIIToUTF16("'One,', 'two,', 'three!'"), | 207 ASSERT_EQ(base::ASCIIToUTF16("'One,', 'two,', 'three!'"), |
212 TraverseNodeAtGranularity(pre, GRANULARITY_LINE)); | 208 TraverseNodeAtGranularity(pre, GRANULARITY_LINE)); |
213 } | 209 } |
214 | 210 |
215 } // namespace content | 211 } // namespace content |
OLD | NEW |