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

Side by Side Diff: components/autofill/core/browser/autofill_field_unittest.cc

Issue 1583563003: [Autofill] Parse forms that have autocomplete attributes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "components/autofill/core/browser/autofill_field.h" 5 #include "components/autofill/core/browser/autofill_field.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/strings/string_number_conversions.h" 10 #include "base/strings/string_number_conversions.h"
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 AutofillField::FillFormField( 267 AutofillField::FillFormField(
268 field, ASCIIToUTF16("Oh hai"), "en-US", "en-US", &field); 268 field, ASCIIToUTF16("Oh hai"), "en-US", "en-US", &field);
269 EXPECT_EQ(ASCIIToUTF16("Oh hai"), field.value); 269 EXPECT_EQ(ASCIIToUTF16("Oh hai"), field.value);
270 270
271 // Fill with a phone number; should fill just the prefix. 271 // Fill with a phone number; should fill just the prefix.
272 AutofillField::FillFormField( 272 AutofillField::FillFormField(
273 field, ASCIIToUTF16("5551234"), "en-US", "en-US", &field); 273 field, ASCIIToUTF16("5551234"), "en-US", "en-US", &field);
274 EXPECT_EQ(ASCIIToUTF16("555"), field.value); 274 EXPECT_EQ(ASCIIToUTF16("555"), field.value);
275 275
276 // Now reset the type, and set a max-length instead. 276 // Now reset the type, and set a max-length instead.
277 field.SetHtmlType(HTML_TYPE_UNKNOWN, HtmlFieldMode()); 277 field.SetHtmlType(HTML_TYPE_UNSPECIFIED, HtmlFieldMode());
278 field.set_heuristic_type(PHONE_HOME_NUMBER); 278 field.set_heuristic_type(PHONE_HOME_NUMBER);
279 field.max_length = 4; 279 field.max_length = 4;
280 280
281 // Fill with a phone-number; should fill just the suffix. 281 // Fill with a phone-number; should fill just the suffix.
282 AutofillField::FillFormField( 282 AutofillField::FillFormField(
283 field, ASCIIToUTF16("5551234"), "en-US", "en-US", &field); 283 field, ASCIIToUTF16("5551234"), "en-US", "en-US", &field);
284 EXPECT_EQ(ASCIIToUTF16("1234"), field.value); 284 EXPECT_EQ(ASCIIToUTF16("1234"), field.value);
285 } 285 }
286 286
287 TEST(AutofillFieldTest, FillSelectControlByValue) { 287 TEST(AutofillFieldTest, FillSelectControlByValue) {
(...skipping 513 matching lines...) Expand 10 before | Expand all | Expand 10 after
801 index = kBadIndex; 801 index = kBadIndex;
802 ret = AutofillField::FindValueInSelectControl( 802 ret = AutofillField::FindValueInSelectControl(
803 field, UTF8ToUTF16("NoVaScOtIa"), &index); 803 field, UTF8ToUTF16("NoVaScOtIa"), &index);
804 EXPECT_TRUE(ret); 804 EXPECT_TRUE(ret);
805 EXPECT_EQ(2U, index); 805 EXPECT_EQ(2U, index);
806 } 806 }
807 } 807 }
808 808
809 } // namespace 809 } // namespace
810 } // namespace autofill 810 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698