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

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

Issue 2970013003: [Payment Request] Displays appropriate footer if first transaction completed (Closed)
Patch Set: Addressed comments + rebase Created 3 years, 5 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 17 matching lines...) Expand all
28 #include "components/signin/core/common/signin_pref_names.h" 28 #include "components/signin/core/common/signin_pref_names.h"
29 29
30 using base::ASCIIToUTF16; 30 using base::ASCIIToUTF16;
31 31
32 namespace autofill { 32 namespace autofill {
33 namespace test { 33 namespace test {
34 34
35 std::unique_ptr<PrefService> PrefServiceForTesting() { 35 std::unique_ptr<PrefService> PrefServiceForTesting() {
36 scoped_refptr<user_prefs::PrefRegistrySyncable> registry( 36 scoped_refptr<user_prefs::PrefRegistrySyncable> registry(
37 new user_prefs::PrefRegistrySyncable()); 37 new user_prefs::PrefRegistrySyncable());
38 AutofillManager::RegisterProfilePrefs(registry.get()); 38 return PrefServiceForTesting(registry.get());
39 }
40
41 std::unique_ptr<PrefService> PrefServiceForTesting(
42 user_prefs::PrefRegistrySyncable* registry) {
43 AutofillManager::RegisterProfilePrefs(registry);
39 44
40 // PDM depends on these prefs, which are normally registered in 45 // PDM depends on these prefs, which are normally registered in
41 // SigninManagerFactory. 46 // SigninManagerFactory.
42 registry->RegisterStringPref(::prefs::kGoogleServicesAccountId, 47 registry->RegisterStringPref(::prefs::kGoogleServicesAccountId,
43 std::string()); 48 std::string());
44 registry->RegisterStringPref(::prefs::kGoogleServicesLastAccountId, 49 registry->RegisterStringPref(::prefs::kGoogleServicesLastAccountId,
45 std::string()); 50 std::string());
46 registry->RegisterStringPref(::prefs::kGoogleServicesLastUsername, 51 registry->RegisterStringPref(::prefs::kGoogleServicesLastUsername,
47 std::string()); 52 std::string());
48 registry->RegisterStringPref(::prefs::kGoogleServicesUserAccountId, 53 registry->RegisterStringPref(::prefs::kGoogleServicesUserAccountId,
49 std::string()); 54 std::string());
50 registry->RegisterStringPref(::prefs::kGoogleServicesUsername, 55 registry->RegisterStringPref(::prefs::kGoogleServicesUsername,
51 std::string()); 56 std::string());
52 57
53 // PDM depends on these prefs, which are normally registered in 58 // PDM depends on these prefs, which are normally registered in
54 // AccountTrackerServiceFactory. 59 // AccountTrackerServiceFactory.
55 registry->RegisterListPref(AccountTrackerService::kAccountInfoPref); 60 registry->RegisterListPref(AccountTrackerService::kAccountInfoPref);
56 registry->RegisterIntegerPref(::prefs::kAccountIdMigrationState, 61 registry->RegisterIntegerPref(::prefs::kAccountIdMigrationState,
57 AccountTrackerService::MIGRATION_NOT_STARTED); 62 AccountTrackerService::MIGRATION_NOT_STARTED);
58 registry->RegisterInt64Pref(AccountFetcherService::kLastUpdatePref, 0); 63 registry->RegisterInt64Pref(AccountFetcherService::kLastUpdatePref, 0);
59 64
60 PrefServiceFactory factory; 65 PrefServiceFactory factory;
61 factory.set_user_prefs(make_scoped_refptr(new TestingPrefStore())); 66 factory.set_user_prefs(make_scoped_refptr(new TestingPrefStore()));
62 return factory.Create(registry.get()); 67 return factory.Create(registry);
63 } 68 }
64 69
65 void CreateTestFormField(const char* label, 70 void CreateTestFormField(const char* label,
66 const char* name, 71 const char* name,
67 const char* value, 72 const char* value,
68 const char* type, 73 const char* type,
69 FormFieldData* field) { 74 FormFieldData* field) {
70 field->label = ASCIIToUTF16(label); 75 field->label = ASCIIToUTF16(label);
71 field->name = ASCIIToUTF16(name); 76 field->name = ASCIIToUTF16(name);
72 field->value = ASCIIToUTF16(value); 77 field->value = ASCIIToUTF16(value);
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after
376 const char* control_type) { 381 const char* control_type) {
377 field->set_signature(signature); 382 field->set_signature(signature);
378 if (name) 383 if (name)
379 field->set_name(name); 384 field->set_name(name);
380 if (control_type) 385 if (control_type)
381 field->set_type(control_type); 386 field->set_type(control_type);
382 } 387 }
383 388
384 } // namespace test 389 } // namespace test
385 } // namespace autofill 390 } // namespace autofill
OLDNEW
« no previous file with comments | « components/autofill/core/browser/autofill_test_utils.h ('k') | components/payments/core/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698