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