OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/format_macros.h" | 7 #include "base/format_macros.h" |
8 #include "base/strings/string16.h" | 8 #include "base/strings/string16.h" |
9 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
(...skipping 3379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3390 "<DIV>Email:</DIV>" | 3390 "<DIV>Email:</DIV>" |
3391 "<DIV>" | 3391 "<DIV>" |
3392 " <SPAN>" | 3392 " <SPAN>" |
3393 " <INPUT type='text' name='email' value='john@example.com'>" | 3393 " <INPUT type='text' name='email' value='john@example.com'>" |
3394 " </SPAN>" | 3394 " </SPAN>" |
3395 "</DIV>" | 3395 "</DIV>" |
3396 "<input type='submit' name='reply-send' value='Send'>" | 3396 "<input type='submit' name='reply-send' value='Send'>" |
3397 "</FORM>"); | 3397 "</FORM>"); |
3398 } | 3398 } |
3399 | 3399 |
| 3400 TEST_F(FormAutofillTest, LabelsInferredFromLabelInDivTable) { |
| 3401 ExpectJohnSmithLabels( |
| 3402 "<FORM name='TestForm' action='http://cnn.com' method='post'>" |
| 3403 "<LABEL>First name:</LABEL>" |
| 3404 "<LABEL for='lastname'>Last name:</LABEL>" |
| 3405 "<DIV>" |
| 3406 " <INPUT type='text' id='firstname' value='John'>" |
| 3407 "</DIV>" |
| 3408 "<DIV>" |
| 3409 " <INPUT type='text' id='lastname' value='Smith'>" |
| 3410 "</DIV>" |
| 3411 "<LABEL>Email:</LABEL>" |
| 3412 "<DIV>" |
| 3413 " <SPAN>" |
| 3414 " <INPUT type='text' id='email' value='john@example.com'>" |
| 3415 " </SPAN>" |
| 3416 "</DIV>" |
| 3417 "<input type='submit' name='reply-send' value='Send'>" |
| 3418 "</FORM>"); |
| 3419 } |
| 3420 |
3400 TEST_F(FormAutofillTest, LabelsInferredFromDefinitionListRatherThanDivTable) { | 3421 TEST_F(FormAutofillTest, LabelsInferredFromDefinitionListRatherThanDivTable) { |
3401 ExpectJohnSmithLabels( | 3422 ExpectJohnSmithLabels( |
3402 "<FORM name='TestForm' action='http://cnn.com' method='post'>" | 3423 "<FORM name='TestForm' action='http://cnn.com' method='post'>" |
3403 "<DIV>This is not a label.<BR>" | 3424 "<DIV>This is not a label.<BR>" |
3404 "<DL>" | 3425 "<DL>" |
3405 " <DT>" | 3426 " <DT>" |
3406 " <SPAN>" | 3427 " <SPAN>" |
3407 " First name:" | 3428 " First name:" |
3408 " </SPAN>" | 3429 " </SPAN>" |
3409 " </DT>" | 3430 " </DT>" |
(...skipping 722 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4132 ASSERT_TRUE(control_elements.empty()); | 4153 ASSERT_TRUE(control_elements.empty()); |
4133 ASSERT_TRUE(fieldsets.empty()); | 4154 ASSERT_TRUE(fieldsets.empty()); |
4134 | 4155 |
4135 FormData form; | 4156 FormData form; |
4136 EXPECT_FALSE(UnownedFormElementsAndFieldSetsToFormData( | 4157 EXPECT_FALSE(UnownedFormElementsAndFieldSetsToFormData( |
4137 fieldsets, control_elements, nullptr, dummy_origin, REQUIRE_NONE, | 4158 fieldsets, control_elements, nullptr, dummy_origin, REQUIRE_NONE, |
4138 extract_mask, &form, nullptr)); | 4159 extract_mask, &form, nullptr)); |
4139 } | 4160 } |
4140 | 4161 |
4141 } // namespace autofill | 4162 } // namespace autofill |
OLD | NEW |