File: test_profiles.h

package info (click to toggle)
chromium 138.0.7204.183-1~deb12u1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm-proposed-updates
  • size: 6,080,960 kB
  • sloc: cpp: 34,937,079; ansic: 7,176,967; javascript: 4,110,704; python: 1,419,954; asm: 946,768; xml: 739,971; pascal: 187,324; sh: 89,623; perl: 88,663; objc: 79,944; sql: 50,304; cs: 41,786; fortran: 24,137; makefile: 21,811; php: 13,980; tcl: 13,166; yacc: 8,925; ruby: 7,485; awk: 3,720; lisp: 3,096; lex: 1,327; ada: 727; jsp: 228; sed: 36
file content (73 lines) | stat: -rw-r--r-- 2,891 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef COMPONENTS_AUTOFILL_CORE_BROWSER_TEST_UTILS_TEST_PROFILES_H_
#define COMPONENTS_AUTOFILL_CORE_BROWSER_TEST_UTILS_TEST_PROFILES_H_

#include <ranges>

#include "base/strings/utf_string_conversions.h"
#include "components/autofill/core/browser/data_model/addresses/autofill_profile.h"
#include "components/autofill/core/browser/data_model/addresses/autofill_structured_address_test_utils.h"

namespace autofill::test {

// Defines the |value| and |verification_status| for a specific Autofill
// |field_type|
struct ProfileTestData {
  FieldType field_type;
  std::string value;
  VerificationStatus verification_status = VerificationStatus::kNoStatus;
};

// Set the values and verification statuses for the field types in
// |profile_test_data|. If |finalize|, the finalization routine of the
// AutofillProfile is called subsequently.
void SetProfileTestValues(AutofillProfile* profile,
                          const std::vector<ProfileTestData>& profile_test_data,
                          bool finalize = true);

// Copies the GUID from |from| to |to|.
void CopyGUID(const AutofillProfile& from, AutofillProfile* to);

// Convenience function to set the test data but with a verification status that
// is set to |kObserved| for all values.
void SetProfileObservedTestValues(AutofillProfile* profile,
                                  const std::vector<ProfileTestData>& test_data,
                                  bool finalize = true);

// A standard AutofillProfile. All subsequent profiles are defined with respect
// to this one.
AutofillProfile StandardProfile(
    AddressCountryCode country_code = AddressCountryCode("US"));

// This profile is similar to the standard profile defined above.
// Here, the verification status for the name is 'only' observed. When merged
// with the `StandardProfile()`, this should result in a silent update.
AutofillProfile UpdateableStandardProfile();

// This profile is similar to the standard profile defined above.
// This profile is both lacking a city and a ZIP code and should be merged with
// the `StandardProfile(}`.
AutofillProfile SubsetOfStandardProfile();

// This profile that is not similar to the standard profile.
AutofillProfile DifferentFromStandardProfile();

// Basic profile with alternative name in Hiragana and the address related field
// values missing.
AutofillProfile HiraganaProfile();

// Copy of `HiraganaProfile()` with address fields set.
AutofillProfile ExtendedHiraganaProfile();

// Copy of `HiraganaProfile()` but alternative name is in Katakana.
AutofillProfile KatakanaProfile1();

// A new Katakana profile
AutofillProfile KatakanaProfile2();

}  // namespace autofill::test

#endif  // COMPONENTS_AUTOFILL_CORE_BROWSER_TEST_UTILS_TEST_PROFILES_H_