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

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

Issue 1885773002: [Autofill] Don't fill expiration date of expired credit cards. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Nit Created 4 years, 8 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_test_utils.h" 5 #include "components/autofill/core/browser/autofill_test_utils.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/guid.h" 9 #include "base/guid.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 const char* value, 72 const char* value,
73 const char* type, 73 const char* type,
74 FormFieldData* field) { 74 FormFieldData* field) {
75 field->label = ASCIIToUTF16(label); 75 field->label = ASCIIToUTF16(label);
76 field->name = ASCIIToUTF16(name); 76 field->name = ASCIIToUTF16(name);
77 field->value = ASCIIToUTF16(value); 77 field->value = ASCIIToUTF16(value);
78 field->form_control_type = type; 78 field->form_control_type = type;
79 field->is_focusable = true; 79 field->is_focusable = true;
80 } 80 }
81 81
82 void CreateTestSelectField(const char* label,
83 const char* name,
84 const char* value,
85 const std::vector<const char*>& values,
86 const std::vector<const char*>& contents,
87 size_t select_size,
88 FormFieldData* field) {
89 // Fill the base attributes.
90 CreateTestFormField(label, name, value, "select-one", field);
91
92 std::vector<base::string16> values16(select_size);
93 for (size_t i = 0; i < select_size; ++i)
94 values16[i] = base::UTF8ToUTF16(values[i]);
95
96 std::vector<base::string16> contents16(select_size);
97 for (size_t i = 0; i < select_size; ++i)
98 contents16[i] = base::UTF8ToUTF16(contents[i]);
99
100 field->option_values = values16;
101 field->option_contents = contents16;
102 }
103
104 void CreateTestSelectField(const std::vector<const char*>& values,
105 FormFieldData* field) {
106 CreateTestSelectField("", "", "", values, values, values.size(), field);
107 }
108
82 void CreateTestAddressFormData(FormData* form) { 109 void CreateTestAddressFormData(FormData* form) {
83 std::vector<ServerFieldTypeSet> types; 110 std::vector<ServerFieldTypeSet> types;
84 CreateTestAddressFormData(form, &types); 111 CreateTestAddressFormData(form, &types);
85 } 112 }
86 113
87 void CreateTestAddressFormData(FormData* form, 114 void CreateTestAddressFormData(FormData* form,
88 std::vector<ServerFieldTypeSet>* types) { 115 std::vector<ServerFieldTypeSet>* types) {
89 form->name = ASCIIToUTF16("MyForm"); 116 form->name = ASCIIToUTF16("MyForm");
90 form->origin = GURL("http://myform.com/form.html"); 117 form->origin = GURL("http://myform.com/form.html");
91 form->action = GURL("http://myform.com/submit.html"); 118 form->action = GURL("http://myform.com/submit.html");
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
340 if (name) 367 if (name)
341 field->set_name(name); 368 field->set_name(name);
342 if (control_type) 369 if (control_type)
343 field->set_type(control_type); 370 field->set_type(control_type);
344 if (label) 371 if (label)
345 field->set_label(label); 372 field->set_label(label);
346 } 373 }
347 374
348 } // namespace test 375 } // namespace test
349 } // namespace autofill 376 } // namespace autofill
OLDNEW
« no previous file with comments | « components/autofill/core/browser/autofill_test_utils.h ('k') | components/autofill/core/browser/credit_card.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698