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

Side by Side Diff: chrome/browser/autofill/autofill_manager_unittest.cc

Issue 5137004: Autofill: Prefer maxLength to size attribute for form filling heuristics. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Denitting Created 10 years, 1 month 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/browser/autofill/autofill_manager.cc ('k') | chrome/common/render_messages.cc » ('j') | 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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 "app/l10n_util.h" 7 #include "app/l10n_util.h"
8 #include "base/ref_counted.h" 8 #include "base/ref_counted.h"
9 #include "base/scoped_ptr.h" 9 #include "base/scoped_ptr.h"
10 #include "base/scoped_vector.h" 10 #include "base/scoped_vector.h"
(...skipping 1318 matching lines...) Expand 10 before | Expand all | Expand 10 after
1329 form.name = ASCIIToUTF16("MyPhoneForm"); 1329 form.name = ASCIIToUTF16("MyPhoneForm");
1330 form.method = ASCIIToUTF16("POST"); 1330 form.method = ASCIIToUTF16("POST");
1331 form.origin = GURL("http://myform.com/phone_form.html"); 1331 form.origin = GURL("http://myform.com/phone_form.html");
1332 form.action = GURL("http://myform.com/phone_submit.html"); 1332 form.action = GURL("http://myform.com/phone_submit.html");
1333 form.user_submitted = true; 1333 form.user_submitted = true;
1334 1334
1335 webkit_glue::FormField field; 1335 webkit_glue::FormField field;
1336 1336
1337 autofill_test::CreateTestFormField( 1337 autofill_test::CreateTestFormField(
1338 "country code", "country code", "", "text", &field); 1338 "country code", "country code", "", "text", &field);
1339 field.set_size(1); 1339 field.set_max_length(1);
1340 form.fields.push_back(field); 1340 form.fields.push_back(field);
1341 autofill_test::CreateTestFormField( 1341 autofill_test::CreateTestFormField(
1342 "area code", "area code", "", "text", &field); 1342 "area code", "area code", "", "text", &field);
1343 field.set_size(3); 1343 field.set_max_length(3);
1344 form.fields.push_back(field); 1344 form.fields.push_back(field);
1345 autofill_test::CreateTestFormField( 1345 autofill_test::CreateTestFormField(
1346 "phone", "phone prefix", "1", "text", &field); 1346 "phone", "phone prefix", "1", "text", &field);
1347 field.set_size(3); 1347 field.set_max_length(3);
1348 form.fields.push_back(field); 1348 form.fields.push_back(field);
1349 autofill_test::CreateTestFormField( 1349 autofill_test::CreateTestFormField(
1350 "-", "phone suffix", "", "text", &field); 1350 "-", "phone suffix", "", "text", &field);
1351 field.set_size(4); 1351 field.set_max_length(4);
1352 form.fields.push_back(field); 1352 form.fields.push_back(field);
1353 autofill_test::CreateTestFormField( 1353 autofill_test::CreateTestFormField(
1354 "Phone Extension", "ext", "", "text", &field); 1354 "Phone Extension", "ext", "", "text", &field);
1355 field.set_size(3); 1355 field.set_max_length(3);
1356 form.fields.push_back(field); 1356 form.fields.push_back(field);
1357 1357
1358 // Set up our FormStructures. 1358 // Set up our FormStructures.
1359 std::vector<FormData> forms; 1359 std::vector<FormData> forms;
1360 forms.push_back(form); 1360 forms.push_back(form);
1361 autofill_manager_->FormsSeen(forms); 1361 autofill_manager_->FormsSeen(forms);
1362 1362
1363 AutoFillProfile *work_profile = autofill_manager_->GetLabeledProfile("Work"); 1363 AutoFillProfile *work_profile = autofill_manager_->GetLabeledProfile("Work");
1364 EXPECT_TRUE(work_profile != NULL); 1364 EXPECT_TRUE(work_profile != NULL);
1365 const AutoFillType phone_type(PHONE_HOME_NUMBER); 1365 const AutoFillType phone_type(PHONE_HOME_NUMBER);
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
1578 ASSERT_FALSE(profile()->GetPrefs()->GetBoolean( 1578 ASSERT_FALSE(profile()->GetPrefs()->GetBoolean(
1579 prefs::kAutoFillAuxiliaryProfilesEnabled)); 1579 prefs::kAutoFillAuxiliaryProfilesEnabled));
1580 profile()->GetPrefs()->SetBoolean( 1580 profile()->GetPrefs()->SetBoolean(
1581 prefs::kAutoFillAuxiliaryProfilesEnabled, true); 1581 prefs::kAutoFillAuxiliaryProfilesEnabled, true);
1582 profile()->GetPrefs()->ClearPref(prefs::kAutoFillAuxiliaryProfilesEnabled); 1582 profile()->GetPrefs()->ClearPref(prefs::kAutoFillAuxiliaryProfilesEnabled);
1583 ASSERT_FALSE(profile()->GetPrefs()->GetBoolean( 1583 ASSERT_FALSE(profile()->GetPrefs()->GetBoolean(
1584 prefs::kAutoFillAuxiliaryProfilesEnabled)); 1584 prefs::kAutoFillAuxiliaryProfilesEnabled));
1585 #endif 1585 #endif
1586 } 1586 }
1587 1587
OLDNEW
« no previous file with comments | « chrome/browser/autofill/autofill_manager.cc ('k') | chrome/common/render_messages.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698