Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(163)

Side by Side Diff: content/browser/accessibility/android_granularity_movement_browsertest.cc

Issue 2439203003: Reland of Accessibility: Ignore all anonymous blocks (Closed)
Patch Set: Rebased. Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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>"
152 "<button aria-label='Seven, eight, nine!'>Four, five, six!</button>" 153 "<button aria-label='Seven, eight, nine!'>Four, five, six!</button>"
154 "</p>"
153 "</body></html>"); 155 "</body></html>");
154 BrowserAccessibility* root = LoadUrlAndGetAccessibilityRoot(url); 156 BrowserAccessibility* root = LoadUrlAndGetAccessibilityRoot(url);
155 ASSERT_EQ(2U, root->PlatformChildCount()); 157 ASSERT_EQ(2U, root->PlatformChildCount());
156 BrowserAccessibility* para = root->PlatformGetChild(0); 158 BrowserAccessibility* para = root->PlatformGetChild(0);
157 ASSERT_EQ(0U, para->PlatformChildCount()); 159 ASSERT_EQ(0U, para->PlatformChildCount());
158 BrowserAccessibility* button_container = root->PlatformGetChild(1); 160 BrowserAccessibility* button_container = root->PlatformGetChild(1);
159 ASSERT_EQ(1U, button_container->PlatformChildCount()); 161 ASSERT_EQ(1U, button_container->PlatformChildCount());
160 BrowserAccessibility* button = button_container->PlatformGetChild(0); 162 BrowserAccessibility* button = button_container->PlatformGetChild(0);
161 ASSERT_EQ(0U, button->PlatformChildCount()); 163 ASSERT_EQ(0U, button->PlatformChildCount());
162 164
163 ASSERT_EQ( 165 ASSERT_EQ(
164 base::ASCIIToUTF16("'O', 'n', 'e', ',', ' ', 't', 'w', 'o', " 166 base::ASCIIToUTF16("'O', 'n', 'e', ',', ' ', 't', 'w', 'o', "
165 "',', ' ', 't', 'h', 'r', 'e', 'e', '!'"), 167 "',', ' ', 't', 'h', 'r', 'e', 'e', '!'"),
166 TraverseNodeAtGranularity(para, GRANULARITY_CHARACTER)); 168 TraverseNodeAtGranularity(para, GRANULARITY_CHARACTER));
167 ASSERT_EQ( 169 ASSERT_EQ(
168 base::ASCIIToUTF16("'S', 'e', 'v', 'e', 'n', ',', ' ', 'e', 'i', 'g', " 170 base::ASCIIToUTF16("'S', 'e', 'v', 'e', 'n', ',', ' ', 'e', 'i', 'g', "
169 "'h', 't', ',', ' ', 'n', 'i', 'n', 'e', '!'"), 171 "'h', 't', ',', ' ', 'n', 'i', 'n', 'e', '!'"),
170 TraverseNodeAtGranularity(button, GRANULARITY_CHARACTER)); 172 TraverseNodeAtGranularity(button, GRANULARITY_CHARACTER));
171 } 173 }
172 174
173 IN_PROC_BROWSER_TEST_F(AndroidGranularityMovementBrowserTest, 175 IN_PROC_BROWSER_TEST_F(AndroidGranularityMovementBrowserTest,
174 NavigateByWords) { 176 NavigateByWords) {
175 GURL url("data:text/html," 177 GURL url("data:text/html,"
176 "<body>" 178 "<body>"
177 "<p>One, two, three!</p>" 179 "<p>One, two, three!</p>"
180 "<p>"
178 "<button aria-label='Seven, eight, nine!'>Four, five, six!</button>" 181 "<button aria-label='Seven, eight, nine!'>Four, five, six!</button>"
182 "</p>"
179 "</body></html>"); 183 "</body></html>");
180 BrowserAccessibility* root = LoadUrlAndGetAccessibilityRoot(url); 184 BrowserAccessibility* root = LoadUrlAndGetAccessibilityRoot(url);
181 ASSERT_EQ(2U, root->PlatformChildCount()); 185 ASSERT_EQ(2U, root->PlatformChildCount());
182 BrowserAccessibility* para = root->PlatformGetChild(0); 186 BrowserAccessibility* para = root->PlatformGetChild(0);
183 ASSERT_EQ(0U, para->PlatformChildCount()); 187 ASSERT_EQ(0U, para->PlatformChildCount());
184 BrowserAccessibility* button_container = root->PlatformGetChild(1); 188 BrowserAccessibility* button_container = root->PlatformGetChild(1);
185 ASSERT_EQ(1U, button_container->PlatformChildCount()); 189 ASSERT_EQ(1U, button_container->PlatformChildCount());
186 BrowserAccessibility* button = button_container->PlatformGetChild(0); 190 BrowserAccessibility* button = button_container->PlatformGetChild(0);
187 ASSERT_EQ(0U, button->PlatformChildCount()); 191 ASSERT_EQ(0U, button->PlatformChildCount());
188 192
(...skipping 12 matching lines...) Expand all
201 BrowserAccessibility* root = LoadUrlAndGetAccessibilityRoot(url); 205 BrowserAccessibility* root = LoadUrlAndGetAccessibilityRoot(url);
202 ASSERT_EQ(1U, root->PlatformChildCount()); 206 ASSERT_EQ(1U, root->PlatformChildCount());
203 BrowserAccessibility* pre = root->PlatformGetChild(0); 207 BrowserAccessibility* pre = root->PlatformGetChild(0);
204 ASSERT_EQ(0U, pre->PlatformChildCount()); 208 ASSERT_EQ(0U, pre->PlatformChildCount());
205 209
206 ASSERT_EQ(base::ASCIIToUTF16("'One,', 'two,', 'three!'"), 210 ASSERT_EQ(base::ASCIIToUTF16("'One,', 'two,', 'three!'"),
207 TraverseNodeAtGranularity(pre, GRANULARITY_LINE)); 211 TraverseNodeAtGranularity(pre, GRANULARITY_LINE));
208 } 212 }
209 213
210 } // namespace content 214 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698