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

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

Issue 11867025: Download autocheckout whitelist and enable autocheckout for whitelisted sites only. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Pass autocheckout url prefix to FormStructure's constructor. Created 7 years, 10 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 | Annotate | Revision Log
OLDNEW
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/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/file_path.h" 8 #include "base/file_path.h"
9 #include "base/string_util.h" 9 #include "base/string_util.h"
10 #include "base/utf_string_conversions.h" 10 #include "base/utf_string_conversions.h"
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 field.name = field_type; 180 field.name = field_type;
181 field.value = value; 181 field.value = value;
182 field.form_control_type = "text"; 182 field.form_control_type = "text";
183 form.fields.push_back(field); 183 form.fields.push_back(field);
184 } 184 }
185 185
186 // The first line is always a profile separator, and the last profile is not 186 // The first line is always a profile separator, and the last profile is not
187 // followed by an explicit separator. 187 // followed by an explicit separator.
188 if ((i > 0 && line == kProfileSeparator) || i == lines.size() - 1) { 188 if ((i > 0 && line == kProfileSeparator) || i == lines.size() - 1) {
189 // Reached the end of a profile. Try to import it. 189 // Reached the end of a profile. Try to import it.
190 FormStructure form_structure(form); 190 FormStructure form_structure(form, std::string());
191 for (size_t i = 0; i < form_structure.field_count(); ++i) { 191 for (size_t i = 0; i < form_structure.field_count(); ++i) {
192 // Set the heuristic type for each field, which is currently serialized 192 // Set the heuristic type for each field, which is currently serialized
193 // into the field's name. 193 // into the field's name.
194 AutofillField* field = 194 AutofillField* field =
195 const_cast<AutofillField*>(form_structure.field(i)); 195 const_cast<AutofillField*>(form_structure.field(i));
196 AutofillFieldType type = 196 AutofillFieldType type =
197 AutofillType::StringToFieldType(UTF16ToUTF8(field->name)); 197 AutofillType::StringToFieldType(UTF16ToUTF8(field->name));
198 field->set_heuristic_type(type); 198 field->set_heuristic_type(type);
199 } 199 }
200 200
201 // Import the profile. 201 // Import the profile.
202 const CreditCard* imported_credit_card; 202 const CreditCard* imported_credit_card;
203 personal_data_.ImportFormData(form_structure, &imported_credit_card); 203 personal_data_.ImportFormData(form_structure, &imported_credit_card);
204 EXPECT_EQ(static_cast<const CreditCard*>(NULL), imported_credit_card); 204 EXPECT_EQ(static_cast<const CreditCard*>(NULL), imported_credit_card);
205 205
206 // Clear the |form| to start a new profile. 206 // Clear the |form| to start a new profile.
207 form.fields.clear(); 207 form.fields.clear();
208 } 208 }
209 } 209 }
210 210
211 *merged_profiles = SerializeProfiles(personal_data_.web_profiles()); 211 *merged_profiles = SerializeProfiles(personal_data_.web_profiles());
212 } 212 }
213 213
214 TEST_F(AutofillMergeTest, DataDrivenMergeProfiles) { 214 TEST_F(AutofillMergeTest, DataDrivenMergeProfiles) {
215 RunDataDrivenTest(GetInputDirectory(kTestName), GetOutputDirectory(kTestName), 215 RunDataDrivenTest(GetInputDirectory(kTestName), GetOutputDirectory(kTestName),
216 kFileNamePattern); 216 kFileNamePattern);
217 } 217 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698