chromium/components/autofill/core/browser/data_model/autofill_profile_unittest.cc

// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "components/autofill/core/browser/data_model/autofill_profile.h"

#include <stddef.h>

#include <memory>
#include <string>
#include <vector>

#include "base/format_macros.h"
#include "base/memory/raw_ptr.h"
#include "base/strings/utf_string_conversions.h"
#include "base/test/metrics/histogram_tester.h"
#include "base/test/scoped_feature_list.h"
#include "base/test/task_environment.h"
#include "base/time/time.h"
#include "base/uuid.h"
#include "components/autofill/core/browser/autofill_test_utils.h"
#include "components/autofill/core/browser/autofill_type.h"
#include "components/autofill/core/browser/data_model/autofill_profile_comparator.h"
#include "components/autofill/core/browser/field_types.h"
#include "components/autofill/core/browser/geo/country_data.h"
#include "components/autofill/core/browser/profile_token_quality.h"
#include "components/autofill/core/browser/profile_token_quality_test_api.h"
#include "components/autofill/core/browser/test_utils/test_profiles.h"
#include "components/autofill/core/common/autofill_constants.h"
#include "components/autofill/core/common/autofill_features.h"
#include "components/autofill/core/common/form_field_data.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"

namespace autofill {

UTF8ToUTF16;
ObservationType;

constexpr VerificationStatus kObserved =;

namespace {

std::u16string GetSuggestionLabel(AutofillProfile* profile) {}

void SetupTestProfile(AutofillProfile& profile) {}

std::vector<raw_ptr<const AutofillProfile, VectorExperimental>>
ToRawPointerVector(const std::vector<std::unique_ptr<AutofillProfile>>& list) {}

class AutofillProfileTest : public testing::Test {};

// Tests different possibilities for summary string generation.
// Based on existence of first name, last name, and address line 1.
TEST_F(AutofillProfileTest, PreviewSummaryString) {}

TEST_F(AutofillProfileTest, AdjustInferredLabels) {}

TEST_F(AutofillProfileTest, CreateInferredLabelsI18n_CH) {}

TEST_F(AutofillProfileTest, CreateInferredLabelsI18n_FR) {}

TEST_F(AutofillProfileTest, CreateInferredLabelsI18n_KR) {}

TEST_F(AutofillProfileTest, CreateInferredLabelsI18n_JP_Latn) {}

TEST_F(AutofillProfileTest, CreateInferredLabelsI18n_JP_ja) {}

TEST_F(AutofillProfileTest, CreateInferredLabels) {}

// Test that we fall back to using the full name if there are no other
// distinguishing fields, but only if it makes sense given the suggested fields.
TEST_F(AutofillProfileTest, CreateInferredLabelsFallsBackToFullName) {}

// Test that we use the triggering field to decide whether an additional
// differentiating label should be added.
TEST_F(
    AutofillProfileTest,
    CreateInferredLabels_TriggeringFieldUsedToDecideWhetherToAddADifferentiatingLabel) {}

// Test that we do not show duplicate fields in the labels.
TEST_F(AutofillProfileTest, CreateInferredLabelsNoDuplicatedFields) {}

// Make sure that empty fields are not treated as distinguishing fields.
TEST_F(AutofillProfileTest, CreateInferredLabelsSkipsEmptyFields) {}

// Test that labels that would otherwise have multiline values are flattened.
TEST_F(AutofillProfileTest, CreateInferredLabelsFlattensMultiLineValues) {}

// Test that `ADDRESS_HOME_LINE2` is used as a differentiating label if
// necessary.
TEST_F(AutofillProfileTest, CreateInferredLabelsDifferentiateByAddressLine2) {}

TEST_F(AutofillProfileTest, IsSubsetOf) {}

TEST_F(AutofillProfileTest, IsSubsetOfForFieldSet_DifferentMiddleNames) {}

TEST_F(AutofillProfileTest, IsSubsetOfForFieldSet_DifferentFirstNames) {}

TEST_F(AutofillProfileTest, IsSubsetOfForFieldSet_DifferentLastNames) {}

TEST_F(AutofillProfileTest, IsSubsetOfForFieldSet_DifferentStreetAddresses) {}

TEST_F(AutofillProfileTest, IsSubsetOfForFieldSet_DifferentNonStreetAddresses) {}

TEST_F(AutofillProfileTest,
       IsSubsetOfForFieldSet_PostalCodesWithAndWithoutSpaces) {}

TEST_F(AutofillProfileTest,
       IsSubsetOfForFieldSet_PhoneNumbersWithAndWithoutSpacesAndPunctuation) {}

TEST_F(AutofillProfileTest,
       IsSubsetOfForFieldSet_PhoneNumbersWithAndWithoutCodes_US) {}

TEST_F(AutofillProfileTest,
       IsSubsetOfForFieldSet_PhoneNumbersWithAndWithoutCodes_BR) {}

TEST_F(AutofillProfileTest, IsStrictSupersetOf) {}

TEST_F(AutofillProfileTest, TestFinalizeAfterImport) {}

TEST_F(AutofillProfileTest, SetAndGetRawInfoWithValidationStatus) {}

TEST_F(AutofillProfileTest, SetAndGetInfoWithValidationStatus) {}

TEST_F(AutofillProfileTest, MergeDataFrom_DifferentProfile) {}

TEST_F(AutofillProfileTest, MergeDataFrom_SameProfile) {}

// Tests that when merging two profiles, the token quality is merged.
TEST_F(AutofillProfileTest, MergeDataFrom_TokenQuality) {}

TEST_F(AutofillProfileTest, OverwriteName_AddNameFull) {}

// Tests that OverwriteName overwrites the name parts if they have different
// case.
TEST_F(AutofillProfileTest, OverwriteName_DifferentCase) {}

TEST_F(AutofillProfileTest, AssignmentOperator) {}

TEST_F(AutofillProfileTest, Copy) {}

TEST_F(AutofillProfileTest, Compare) {}

// For each structured profile tokens, test the comparison operator for both the
// value and the status.
// TODO(crbug.com/40275657): Extend this test to cover i18n profiles.
TEST_F(AutofillProfileTest, Compare_StructuredTypes) {}

TEST_F(AutofillProfileTest, IsPresentButInvalid) {}

TEST_F(AutofillProfileTest, SetRawInfoPreservesLineBreaks) {}

TEST_F(AutofillProfileTest, SetInfoPreservesLineBreaks) {}

TEST_F(AutofillProfileTest, SetRawInfoDoesntTrimWhitespace) {}

TEST_F(AutofillProfileTest, SetRawInfoWorksForLandmark) {}

TEST_F(AutofillProfileTest, SetRawInfoWorksForBetweenStreets) {}

TEST_F(AutofillProfileTest, SetInfoTrimsWhitespace) {}

// Test that the label is correctly set and retrieved from the profile.
TEST_F(AutofillProfileTest, SetAndGetProfileLabels) {}

TEST_F(AutofillProfileTest, LabelsInAssignmentAndComparisonOperator) {}

// Tests that `RecordUseAndLog()` only increments the use count if at least 60
// seconds have passed.
TEST_F(AutofillProfileTest, RecordUseAndLog_Delay) {}

// Tests that the |HasStructuredData| returns whether the profile has structured
// data or not.
TEST_F(AutofillProfileTest, HasStructuredData) {}

TEST_F(AutofillProfileTest, ConvertToAccountProfile) {}

TEST_F(AutofillProfileTest, RemoveInaccessibleProfileValues) {}

TEST_F(AutofillProfileTest, GetStorableTypeOf) {}

// Tests that `AutofillProfile::RecordUseAndLog()` logs days until first usage.
TEST_F(AutofillProfileTest, EmitsDaysUntilFirstUsageProfile) {}

enum Expectation {};
struct ProfileRankingTestCase {};

class ProfileRankingTest
    : public AutofillProfileTest,
      public testing::WithParamInterface<ProfileRankingTestCase> {};

TEST_P(ProfileRankingTest, HasGreaterRankingThan) {}

INSTANTIATE_TEST_SUITE_P();

}  // namespace

}  // namespace autofill