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

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

Issue 2010463002: Mocker for OSCrypt (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Updated doc Created 4 years, 6 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 <stddef.h> 5 #include <stddef.h>
6 6
7 #include <map> 7 #include <map>
8 #include <memory> 8 #include <memory>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 // input format. 157 // input format.
158 class AutofillMergeTest : public DataDrivenTest, 158 class AutofillMergeTest : public DataDrivenTest,
159 public testing::TestWithParam<base::FilePath> { 159 public testing::TestWithParam<base::FilePath> {
160 protected: 160 protected:
161 AutofillMergeTest(); 161 AutofillMergeTest();
162 ~AutofillMergeTest() override; 162 ~AutofillMergeTest() override;
163 163
164 // testing::Test: 164 // testing::Test:
165 void SetUp() override; 165 void SetUp() override;
166 166
167 void TearDown() override;
168
167 // DataDrivenTest: 169 // DataDrivenTest:
168 void GenerateResults(const std::string& input, std::string* output) override; 170 void GenerateResults(const std::string& input, std::string* output) override;
169 171
170 // Deserializes a set of Autofill profiles from |profiles|, imports each 172 // Deserializes a set of Autofill profiles from |profiles|, imports each
171 // sequentially, and fills |merged_profiles| with the serialized result. 173 // sequentially, and fills |merged_profiles| with the serialized result.
172 void MergeProfiles(const std::string& profiles, std::string* merged_profiles); 174 void MergeProfiles(const std::string& profiles, std::string* merged_profiles);
173 175
174 // Deserializes |str| into a field type. 176 // Deserializes |str| into a field type.
175 ServerFieldType StringToFieldType(const std::string& str); 177 ServerFieldType StringToFieldType(const std::string& str);
176 178
(...skipping 10 matching lines...) Expand all
187 for (size_t i = NO_SERVER_DATA; i < MAX_VALID_FIELD_TYPE; ++i) { 189 for (size_t i = NO_SERVER_DATA; i < MAX_VALID_FIELD_TYPE; ++i) {
188 ServerFieldType field_type = static_cast<ServerFieldType>(i); 190 ServerFieldType field_type = static_cast<ServerFieldType>(i);
189 string_to_field_type_map_[AutofillType(field_type).ToString()] = field_type; 191 string_to_field_type_map_[AutofillType(field_type).ToString()] = field_type;
190 } 192 }
191 } 193 }
192 194
193 AutofillMergeTest::~AutofillMergeTest() { 195 AutofillMergeTest::~AutofillMergeTest() {
194 } 196 }
195 197
196 void AutofillMergeTest::SetUp() { 198 void AutofillMergeTest::SetUp() {
197 test::DisableSystemServices(NULL); 199 test::DisableSystemServices(nullptr);
200 }
201
202 void AutofillMergeTest::TearDown() {
203 test::ReenableSystemServices();
198 } 204 }
199 205
200 void AutofillMergeTest::GenerateResults(const std::string& input, 206 void AutofillMergeTest::GenerateResults(const std::string& input,
201 std::string* output) { 207 std::string* output) {
202 MergeProfiles(input, output); 208 MergeProfiles(input, output);
203 } 209 }
204 210
205 void AutofillMergeTest::MergeProfiles(const std::string& profiles, 211 void AutofillMergeTest::MergeProfiles(const std::string& profiles,
206 std::string* merged_profiles) { 212 std::string* merged_profiles) {
207 // Start with no saved profiles. 213 // Start with no saved profiles.
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 return string_to_field_type_map_[str]; 279 return string_to_field_type_map_[str];
274 } 280 }
275 281
276 TEST_P(AutofillMergeTest, DataDrivenMergeProfiles) { 282 TEST_P(AutofillMergeTest, DataDrivenMergeProfiles) {
277 RunOneDataDrivenTest(GetParam(), GetOutputDirectory(kTestName)); 283 RunOneDataDrivenTest(GetParam(), GetOutputDirectory(kTestName));
278 } 284 }
279 285
280 INSTANTIATE_TEST_CASE_P(, AutofillMergeTest, testing::ValuesIn(GetTestFiles())); 286 INSTANTIATE_TEST_CASE_P(, AutofillMergeTest, testing::ValuesIn(GetTestFiles()));
281 287
282 } // namespace autofill 288 } // namespace autofill
OLDNEW
« no previous file with comments | « components/autofill/core/browser/BUILD.gn ('k') | components/autofill/core/browser/autofill_metrics_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698