OLD | NEW |
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 1101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1112 " <P>First name:</P><INPUT type=\"text\" " | 1112 " <P>First name:</P><INPUT type=\"text\" " |
1113 " id=\"firstname\" value=\"John\"/>" | 1113 " id=\"firstname\" value=\"John\"/>" |
1114 " <P>Last name:</P>" | 1114 " <P>Last name:</P>" |
1115 " <INPUT type=\"text\" id=\"lastname\" value=\"Smith\"/>" | 1115 " <INPUT type=\"text\" id=\"lastname\" value=\"Smith\"/>" |
1116 " <P>Email:</P>" | 1116 " <P>Email:</P>" |
1117 " <INPUT type=\"text\" id=\"email\" value=\"john@example.com\"/>" | 1117 " <INPUT type=\"text\" id=\"email\" value=\"john@example.com\"/>" |
1118 " <INPUT type=\"submit\" name=\"reply-send\" value=\"Send\"/>" | 1118 " <INPUT type=\"submit\" name=\"reply-send\" value=\"Send\"/>" |
1119 "</FORM>"); | 1119 "</FORM>"); |
1120 } | 1120 } |
1121 | 1121 |
| 1122 TEST_F(FormManagerTest, LabelsInferredFromBold) { |
| 1123 ExpectJohnSmithLabels( |
| 1124 "<FORM name=\"TestForm\" action=\"http://cnn.com\" method=\"post\">" |
| 1125 " <B>First name:</B><INPUT type=\"text\" " |
| 1126 " id=\"firstname\" value=\"John\"/>" |
| 1127 " <B>Last name:</B>" |
| 1128 " <INPUT type=\"text\" id=\"lastname\" value=\"Smith\"/>" |
| 1129 " <B>Email:</B>" |
| 1130 " <INPUT type=\"text\" id=\"email\" value=\"john@example.com\"/>" |
| 1131 " <INPUT type=\"submit\" name=\"reply-send\" value=\"Send\"/>" |
| 1132 "</FORM>"); |
| 1133 } |
| 1134 |
| 1135 TEST_F(FormManagerTest, LabelsInferredPriorToImgOrBr) { |
| 1136 ExpectJohnSmithLabels( |
| 1137 "<FORM name=\"TestForm\" action=\"http://cnn.com\" method=\"post\">" |
| 1138 " First name:<IMG/><INPUT type=\"text\" " |
| 1139 " id=\"firstname\" value=\"John\"/>" |
| 1140 " Last name:<IMG/>" |
| 1141 " <INPUT type=\"text\" id=\"lastname\" value=\"Smith\"/>" |
| 1142 " Email:<BR/>" |
| 1143 " <INPUT type=\"text\" id=\"email\" value=\"john@example.com\"/>" |
| 1144 " <INPUT type=\"submit\" name=\"reply-send\" value=\"Send\"/>" |
| 1145 "</FORM>"); |
| 1146 } |
| 1147 |
1122 TEST_F(FormManagerTest, LabelsInferredFromTableCell) { | 1148 TEST_F(FormManagerTest, LabelsInferredFromTableCell) { |
1123 ExpectJohnSmithLabels( | 1149 ExpectJohnSmithLabels( |
1124 "<FORM name=\"TestForm\" action=\"http://cnn.com\" method=\"post\">" | 1150 "<FORM name=\"TestForm\" action=\"http://cnn.com\" method=\"post\">" |
1125 "<TABLE>" | 1151 "<TABLE>" |
1126 " <TR>" | 1152 " <TR>" |
1127 " <TD>First name:</TD>" | 1153 " <TD>First name:</TD>" |
1128 " <TD><INPUT type=\"text\" id=\"firstname\" value=\"John\"/></TD>" | 1154 " <TD><INPUT type=\"text\" id=\"firstname\" value=\"John\"/></TD>" |
1129 " </TR>" | 1155 " </TR>" |
1130 " <TR>" | 1156 " <TR>" |
1131 " <TD>Last name:</TD>" | 1157 " <TD>Last name:</TD>" |
(...skipping 2001 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3133 WebInputElement::defaultMaxLength(), | 3159 WebInputElement::defaultMaxLength(), |
3134 false))); | 3160 false))); |
3135 EXPECT_TRUE(fields[2].StrictlyEqualsHack( | 3161 EXPECT_TRUE(fields[2].StrictlyEqualsHack( |
3136 FormField(string16(), | 3162 FormField(string16(), |
3137 ASCIIToUTF16("country"), | 3163 ASCIIToUTF16("country"), |
3138 ASCIIToUTF16("AL"), | 3164 ASCIIToUTF16("AL"), |
3139 ASCIIToUTF16("select-one"), | 3165 ASCIIToUTF16("select-one"), |
3140 0, | 3166 0, |
3141 false))); | 3167 false))); |
3142 } | 3168 } |
OLD | NEW |