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

Side by Side Diff: components/autofill/content/browser/wallet/wallet_test_util.cc

Issue 1931043002: Remove requestAutocomplete (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 7 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "components/autofill/content/browser/wallet/wallet_test_util.h"
6
7 #include <stdint.h>
8
9 #include <string>
10 #include <vector>
11
12 #include "base/memory/ptr_util.h"
13 #include "base/strings/string16.h"
14 #include "base/strings/string_number_conversions.h"
15 #include "base/strings/utf_string_conversions.h"
16 #include "base/values.h"
17 #include "components/autofill/content/browser/wallet/full_wallet.h"
18 #include "components/autofill/content/browser/wallet/wallet_address.h"
19
20 using base::ASCIIToUTF16;
21
22 namespace autofill {
23 namespace wallet {
24
25 namespace {
26
27 int FutureYear() {
28 // "In the Year 3000." - Richie "LaBamba" Rosenberg
29 return 3000;
30 }
31
32 } // namespace
33
34 std::vector<base::string16> StreetAddress(const std::string& line1,
35 const std::string& line2) {
36 std::vector<base::string16> street_address;
37 street_address.push_back(ASCIIToUTF16(line1));
38 street_address.push_back(ASCIIToUTF16(line2));
39 return street_address;
40 }
41
42 std::unique_ptr<Address> GetTestAddress() {
43 return base::WrapUnique(new Address(
44 "US", ASCIIToUTF16("recipient_name"),
45 StreetAddress("address_line_1", "address_line_2"),
46 ASCIIToUTF16("locality_name"), ASCIIToUTF16("dependent_locality_name"),
47 ASCIIToUTF16("admin_area_name"), ASCIIToUTF16("postal_code_number"),
48 ASCIIToUTF16("sorting_code"), ASCIIToUTF16("phone_number"), std::string(),
49 "language_code"));
50 }
51
52 std::unique_ptr<Address> GetTestMinimalAddress() {
53 std::unique_ptr<Address> address = GetTestAddress();
54 address->set_is_complete_address(false);
55 return address;
56 }
57
58 std::unique_ptr<FullWallet> GetTestFullWallet() {
59 std::unique_ptr<FullWallet> wallet(
60 new FullWallet(FutureYear(), 12, "528512", "5ec4feecf9d6",
61 GetTestAddress(), GetTestShippingAddress()));
62 std::vector<uint8_t> one_time_pad;
63 base::HexStringToBytes("5F04A8704183", &one_time_pad);
64 wallet->set_one_time_pad(one_time_pad);
65 return wallet;
66 }
67
68 std::unique_ptr<FullWallet> GetTestFullWalletInstrumentOnly() {
69 std::unique_ptr<FullWallet> wallet(
70 new FullWallet(FutureYear(), 12, "528512", "5ec4feecf9d6",
71 GetTestAddress(), std::unique_ptr<Address>()));
72 std::vector<uint8_t> one_time_pad;
73 base::HexStringToBytes("5F04A8704183", &one_time_pad);
74 wallet->set_one_time_pad(one_time_pad);
75 return wallet;
76 }
77
78 std::unique_ptr<Address> GetTestSaveableAddress() {
79 return base::WrapUnique(new Address(
80 "US", ASCIIToUTF16("save_recipient_name"),
81 StreetAddress("save_address_line_1", "save_address_line_2"),
82 ASCIIToUTF16("save_locality_name"),
83 ASCIIToUTF16("save_dependent_locality_name"),
84 ASCIIToUTF16("save_admin_area_name"),
85 ASCIIToUTF16("save_postal_code_number"),
86 ASCIIToUTF16("save_sorting_code"), ASCIIToUTF16("save_phone_number"),
87 std::string(), "save_language_code"));
88 }
89
90 std::unique_ptr<Address> GetTestShippingAddress() {
91 return base::WrapUnique(new Address(
92 "US", ASCIIToUTF16("ship_recipient_name"),
93 StreetAddress("ship_address_line_1", "ship_address_line_2"),
94 ASCIIToUTF16("ship_locality_name"),
95 ASCIIToUTF16("ship_dependent_locality_name"),
96 ASCIIToUTF16("ship_admin_area_name"),
97 ASCIIToUTF16("ship_postal_code_number"),
98 ASCIIToUTF16("ship_sorting_code"), ASCIIToUTF16("ship_phone_number"),
99 "default_address_id", "ship_language_code"));
100 }
101
102 std::unique_ptr<Address> GetTestNonDefaultShippingAddress() {
103 std::unique_ptr<Address> address = GetTestShippingAddress();
104 address->set_object_id("address_id");
105 return address;
106 }
107
108 } // namespace wallet
109 } // namespace autofill
OLDNEW
« no previous file with comments | « components/autofill/content/browser/wallet/wallet_test_util.h ('k') | components/autofill/content/common/autofill_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698