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

Side by Side Diff: chrome/renderer/autofill/form_manager_browsertest.cc

Issue 7044032: Heuristics for grabber-google.com.out (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « chrome/renderer/autofill/form_manager.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 <vector> 5 #include <vector>
6 6
7 #include "base/string16.h" 7 #include "base/string16.h"
8 #include "base/string_util.h" 8 #include "base/string_util.h"
9 #include "base/utf_string_conversions.h" 9 #include "base/utf_string_conversions.h"
10 #include "chrome/renderer/autofill/form_manager.h" 10 #include "chrome/renderer/autofill/form_manager.h"
(...skipping 1255 matching lines...) Expand 10 before | Expand all | Expand 10 after
1266 " <TD></TD>" 1266 " <TD></TD>"
1267 " <TD>" 1267 " <TD>"
1268 " <INPUT type=\"submit\" name=\"reply-send\" value=\"Send\"/>" 1268 " <INPUT type=\"submit\" name=\"reply-send\" value=\"Send\"/>"
1269 " </TD>" 1269 " </TD>"
1270 " </TR>" 1270 " </TR>"
1271 "</TABLE>" 1271 "</TABLE>"
1272 "</FORM>", 1272 "</FORM>",
1273 labels, names, values); 1273 labels, names, values);
1274 } 1274 }
1275 1275
1276 // <script> and <option> tags are excluded when the labels are inferred. 1276 // <script>, <noscript> and <option> tags are excluded when the labels are
1277 // inferred.
1277 // Also <!-- comment --> is excluded. 1278 // Also <!-- comment --> is excluded.
1278 TEST_F(FormManagerTest, LabelsInferredFromTableWithScriptOptionTagAndComment) { 1279 TEST_F(FormManagerTest, LabelsInferredFromTableWithSpecialElements) {
1279 std::vector<string16> labels, names, values, control_types; 1280 std::vector<string16> labels, names, values, control_types;
1280 1281
1281 labels.push_back(ASCIIToUTF16("*First Name")); 1282 labels.push_back(ASCIIToUTF16("*First Name"));
1282 names.push_back(ASCIIToUTF16("firstname")); 1283 names.push_back(ASCIIToUTF16("firstname"));
1283 values.push_back(ASCIIToUTF16("John")); 1284 values.push_back(ASCIIToUTF16("John"));
1284 control_types.push_back(ASCIIToUTF16("text")); 1285 control_types.push_back(ASCIIToUTF16("text"));
1285 1286
1287 labels.push_back(ASCIIToUTF16("*Middle Name"));
1288 names.push_back(ASCIIToUTF16("middlename"));
1289 values.push_back(ASCIIToUTF16("Joe"));
1290 control_types.push_back(ASCIIToUTF16("text"));
1291
1286 labels.push_back(ASCIIToUTF16("*Last Name")); 1292 labels.push_back(ASCIIToUTF16("*Last Name"));
1287 names.push_back(ASCIIToUTF16("lastname")); 1293 names.push_back(ASCIIToUTF16("lastname"));
1288 values.push_back(ASCIIToUTF16("Smith")); 1294 values.push_back(ASCIIToUTF16("Smith"));
1289 control_types.push_back(ASCIIToUTF16("text")); 1295 control_types.push_back(ASCIIToUTF16("text"));
1290 1296
1291 labels.push_back(ASCIIToUTF16("*Country")); 1297 labels.push_back(ASCIIToUTF16("*Country"));
1292 names.push_back(ASCIIToUTF16("country")); 1298 names.push_back(ASCIIToUTF16("country"));
1293 values.push_back(ASCIIToUTF16("US")); 1299 values.push_back(ASCIIToUTF16("US"));
1294 control_types.push_back(ASCIIToUTF16("select-one")); 1300 control_types.push_back(ASCIIToUTF16("select-one"));
1295 1301
(...skipping 12 matching lines...) Expand all
1308 " </TD>" 1314 " </TD>"
1309 " <TD>" 1315 " <TD>"
1310 " <SCRIPT> <!-- function test() { alert('ignored as label'); } -->" 1316 " <SCRIPT> <!-- function test() { alert('ignored as label'); } -->"
1311 " </SCRIPT>" 1317 " </SCRIPT>"
1312 " <INPUT type=\"text\" id=\"firstname\" value=\"John\"/>" 1318 " <INPUT type=\"text\" id=\"firstname\" value=\"John\"/>"
1313 " </TD>" 1319 " </TD>"
1314 " </TR>" 1320 " </TR>"
1315 " <TR>" 1321 " <TR>"
1316 " <TD>" 1322 " <TD>"
1317 " <SPAN>*</SPAN>" 1323 " <SPAN>*</SPAN>"
1324 " <B>Middle Name</B>"
1325 " </TD>"
1326 " <TD>"
1327 " <NOSCRIPT>"
1328 " <P>Bad</P>"
1329 " </NOSCRIPT>"
1330 " <INPUT type=\"text\" id=\"middlename\" value=\"Joe\"/>"
1331 " </TD>"
1332 " </TR>"
1333 " <TR>"
1334 " <TD>"
1335 " <SPAN>*</SPAN>"
1318 " <B>Last Name</B>" 1336 " <B>Last Name</B>"
1319 " </TD>" 1337 " </TD>"
1320 " <TD>" 1338 " <TD>"
1321 " <INPUT type=\"text\" id=\"lastname\" value=\"Smith\"/>" 1339 " <INPUT type=\"text\" id=\"lastname\" value=\"Smith\"/>"
1322 " </TD>" 1340 " </TD>"
1323 " </TR>" 1341 " </TR>"
1324 " <TR>" 1342 " <TR>"
1325 " <TD>" 1343 " <TD>"
1326 " <SPAN>*</SPAN>" 1344 " <SPAN>*</SPAN>"
1327 " <B>Country</B>" 1345 " <B>Country</B>"
(...skipping 1787 matching lines...) Expand 10 before | Expand all | Expand 10 after
3115 WebInputElement::defaultMaxLength(), 3133 WebInputElement::defaultMaxLength(),
3116 false))); 3134 false)));
3117 EXPECT_TRUE(fields[2].StrictlyEqualsHack( 3135 EXPECT_TRUE(fields[2].StrictlyEqualsHack(
3118 FormField(string16(), 3136 FormField(string16(),
3119 ASCIIToUTF16("country"), 3137 ASCIIToUTF16("country"),
3120 ASCIIToUTF16("AL"), 3138 ASCIIToUTF16("AL"),
3121 ASCIIToUTF16("select-one"), 3139 ASCIIToUTF16("select-one"),
3122 0, 3140 0,
3123 false))); 3141 false)));
3124 } 3142 }
OLDNEW
« no previous file with comments | « chrome/renderer/autofill/form_manager.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698