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>" |
153 "<button aria-label='Seven, eight, nine!'>Four, five, six!</button>" | 154 "<button aria-label='Seven, eight, nine!'>Four, five, six!</button>" |
| 155 "</p>" |
154 "</body></html>"); | 156 "</body></html>"); |
155 BrowserAccessibility* root = LoadUrlAndGetAccessibilityRoot(url); | 157 BrowserAccessibility* root = LoadUrlAndGetAccessibilityRoot(url); |
156 ASSERT_EQ(2U, root->PlatformChildCount()); | 158 ASSERT_EQ(2U, root->PlatformChildCount()); |
157 BrowserAccessibility* para = root->PlatformGetChild(0); | 159 BrowserAccessibility* para = root->PlatformGetChild(0); |
158 ASSERT_EQ(0U, para->PlatformChildCount()); | 160 ASSERT_EQ(0U, para->PlatformChildCount()); |
159 BrowserAccessibility* button_container = root->PlatformGetChild(1); | 161 BrowserAccessibility* button_container = root->PlatformGetChild(1); |
160 ASSERT_EQ(1U, button_container->PlatformChildCount()); | 162 ASSERT_EQ(1U, button_container->PlatformChildCount()); |
161 BrowserAccessibility* button = button_container->PlatformGetChild(0); | 163 BrowserAccessibility* button = button_container->PlatformGetChild(0); |
162 ASSERT_EQ(0U, button->PlatformChildCount()); | 164 ASSERT_EQ(0U, button->PlatformChildCount()); |
163 | 165 |
164 ASSERT_EQ( | 166 ASSERT_EQ( |
165 base::ASCIIToUTF16("'O', 'n', 'e', ',', ' ', 't', 'w', 'o', " | 167 base::ASCIIToUTF16("'O', 'n', 'e', ',', ' ', 't', 'w', 'o', " |
166 "',', ' ', 't', 'h', 'r', 'e', 'e', '!'"), | 168 "',', ' ', 't', 'h', 'r', 'e', 'e', '!'"), |
167 TraverseNodeAtGranularity(para, GRANULARITY_CHARACTER)); | 169 TraverseNodeAtGranularity(para, GRANULARITY_CHARACTER)); |
168 ASSERT_EQ( | 170 ASSERT_EQ( |
169 base::ASCIIToUTF16("'S', 'e', 'v', 'e', 'n', ',', ' ', 'e', 'i', 'g', " | 171 base::ASCIIToUTF16("'S', 'e', 'v', 'e', 'n', ',', ' ', 'e', 'i', 'g', " |
170 "'h', 't', ',', ' ', 'n', 'i', 'n', 'e', '!'"), | 172 "'h', 't', ',', ' ', 'n', 'i', 'n', 'e', '!'"), |
171 TraverseNodeAtGranularity(button, GRANULARITY_CHARACTER)); | 173 TraverseNodeAtGranularity(button, GRANULARITY_CHARACTER)); |
172 } | 174 } |
173 | 175 |
174 IN_PROC_BROWSER_TEST_F(AndroidGranularityMovementBrowserTest, | 176 IN_PROC_BROWSER_TEST_F(AndroidGranularityMovementBrowserTest, |
175 NavigateByWords) { | 177 NavigateByWords) { |
176 GURL url("data:text/html," | 178 GURL url("data:text/html," |
177 "<body>" | 179 "<body>" |
178 "<p>One, two, three!</p>" | 180 "<p>One, two, three!</p>" |
| 181 "<p>" |
179 "<button aria-label='Seven, eight, nine!'>Four, five, six!</button>" | 182 "<button aria-label='Seven, eight, nine!'>Four, five, six!</button>" |
| 183 "</p>" |
180 "</body></html>"); | 184 "</body></html>"); |
181 BrowserAccessibility* root = LoadUrlAndGetAccessibilityRoot(url); | 185 BrowserAccessibility* root = LoadUrlAndGetAccessibilityRoot(url); |
182 ASSERT_EQ(2U, root->PlatformChildCount()); | 186 ASSERT_EQ(2U, root->PlatformChildCount()); |
183 BrowserAccessibility* para = root->PlatformGetChild(0); | 187 BrowserAccessibility* para = root->PlatformGetChild(0); |
184 ASSERT_EQ(0U, para->PlatformChildCount()); | 188 ASSERT_EQ(0U, para->PlatformChildCount()); |
185 BrowserAccessibility* button_container = root->PlatformGetChild(1); | 189 BrowserAccessibility* button_container = root->PlatformGetChild(1); |
186 ASSERT_EQ(1U, button_container->PlatformChildCount()); | 190 ASSERT_EQ(1U, button_container->PlatformChildCount()); |
187 BrowserAccessibility* button = button_container->PlatformGetChild(0); | 191 BrowserAccessibility* button = button_container->PlatformGetChild(0); |
188 ASSERT_EQ(0U, button->PlatformChildCount()); | 192 ASSERT_EQ(0U, button->PlatformChildCount()); |
189 | 193 |
(...skipping 12 matching lines...) Expand all Loading... |
202 BrowserAccessibility* root = LoadUrlAndGetAccessibilityRoot(url); | 206 BrowserAccessibility* root = LoadUrlAndGetAccessibilityRoot(url); |
203 ASSERT_EQ(1U, root->PlatformChildCount()); | 207 ASSERT_EQ(1U, root->PlatformChildCount()); |
204 BrowserAccessibility* pre = root->PlatformGetChild(0); | 208 BrowserAccessibility* pre = root->PlatformGetChild(0); |
205 ASSERT_EQ(0U, pre->PlatformChildCount()); | 209 ASSERT_EQ(0U, pre->PlatformChildCount()); |
206 | 210 |
207 ASSERT_EQ(base::ASCIIToUTF16("'One,', 'two,', 'three!'"), | 211 ASSERT_EQ(base::ASCIIToUTF16("'One,', 'two,', 'three!'"), |
208 TraverseNodeAtGranularity(pre, GRANULARITY_LINE)); | 212 TraverseNodeAtGranularity(pre, GRANULARITY_LINE)); |
209 } | 213 } |
210 | 214 |
211 } // namespace content | 215 } // namespace content |
OLD | NEW |