chromium/components/autofill/core/browser/payments/iban_manager_unittest.cc

// Copyright 2022 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/payments/iban_manager.h"

#include <string_view>

#include "base/functional/callback_helpers.h"
#include "base/test/metrics/histogram_tester.h"
#include "base/test/mock_callback.h"
#include "base/test/task_environment.h"
#include "base/uuid.h"
#include "components/autofill/core/browser/autofill_field.h"
#include "components/autofill/core/browser/autofill_test_utils.h"
#include "components/autofill/core/browser/autofill_type.h"
#include "components/autofill/core/browser/field_types.h"
#include "components/autofill/core/browser/form_structure_test_api.h"
#include "components/autofill/core/browser/mock_autofill_optimization_guide.h"
#include "components/autofill/core/browser/payments_data_manager.h"
#include "components/autofill/core/browser/test_autofill_client.h"
#include "components/autofill/core/browser/test_personal_data_manager.h"
#include "components/grit/components_scaled_resources.h"
#include "components/strings/grit/components_strings.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/resource/mock_resource_bundle_delegate.h"
#include "ui/gfx/image/image_unittest_util.h"

_;
Field;
IsEmpty;
Truly;
UnorderedElementsAre;

namespace autofill {

constexpr char kNickname_0[] =;
constexpr char kNickname_1[] =;
constexpr char16_t kIbanValue[] =;

namespace {

MockSuggestionsReturnedCallback;

}  // namespace

class IbanManagerTest : public testing::Test {};

MATCHER_P(MatchesTextAndSuggestionType, suggestion, "") {}

TEST_F(IbanManagerTest, ShowsAllIbanSuggestions) {}

TEST_F(IbanManagerTest, PaymentsAutofillEnabledPrefOff_NoIbanSuggestionsShown) {}

TEST_F(IbanManagerTest, IbanSuggestions_SeparatorAndFooter) {}

TEST_F(IbanManagerTest,
       OnGetSingleFieldSuggestions_FieldEqualsLocalIban_NothingReturned) {}

TEST_F(IbanManagerTest,
       OnGetSingleFieldSuggestions_LocalIbansMatchingPrefix_Shows) {}

// Test that when the input text field is shorter than IBAN's prefix, all IBANs
// with matching prefixes should be returned.
TEST_F(IbanManagerTest,
       OnGetSingleFieldSuggestions_ServerIbansMatchingPrefix_Shows_All) {}

// Test that when the input text field is shorter than IBAN's prefix, only IBANs
// with matching prefixes should be returned.
TEST_F(IbanManagerTest,
       OnGetSingleFieldSuggestions_ServerIbansMatchingPrefix_Shows_Some) {}

// Test that when there is no prefix present, all server IBANs should be
// recommended when the character count of the input text is less than
// `kFieldLengthLimitOnServerIbanSuggestion`.
TEST_F(
    IbanManagerTest,
    OnGetSingleFieldSuggestions_ServerIbansLackingPrefix_ShowsIfFewCharsInField) {}

// Test that when there is no prefix present, no server IBANs should be
// recommended if the length equals or exceeds
// `kFieldLengthLimitOnServerIbanSuggestion`.
TEST_F(
    IbanManagerTest,
    OnGetSingleFieldSuggestions_ServerIbansLackingPrefix_HidesIfManyCharsInField) {}

TEST_F(IbanManagerTest, DoesNotShowIbansForBlockedWebsite) {}

// Test that suggestions are returned on platforms that don't have an
// AutofillOptimizationGuide. Having no AutofillOptimizationGuide means that
// suggestions cannot and will not be blocked.
TEST_F(IbanManagerTest, ShowsIbanSuggestions_OptimizationGuideNotPresent) {}

TEST_F(IbanManagerTest, NotIbanFieldFocused_NoSuggestionsShown) {}

// Tests that when showing IBAN suggestions is allowed by the site-specific
// blocklist, appropriate metrics are logged.
TEST_F(IbanManagerTest, Metrics_Suggestions_Allowed) {}

// Tests that when showing IBAN suggestions is blocked by the site-specific
// blocklist, appropriate metrics are logged.
TEST_F(IbanManagerTest, Metrics_Suggestions_Blocked) {}

// Tests that when showing IBAN suggestions and the site-specific blocklist is
// not available, appropriate metrics are logged.
TEST_F(IbanManagerTest, Metrics_Suggestions_BlocklistNotAccessible) {}

// Test that the metrics for IBAN-related suggestions shown and shown once are
// logged correctly.
TEST_F(IbanManagerTest, Metrics_SuggestionsShown) {}

// Test that the metrics for local IBAN suggestion selected (once and total
// count) are logged correctly.
TEST_F(IbanManagerTest, Metrics_LocalIbanSuggestionSelected) {}

// Test that the metrics for server IBAN suggestion selected (once and total
// count) is logged correctly.
TEST_F(IbanManagerTest, Metrics_ServerIbanSuggestionSelected) {}

TEST_F(IbanManagerTest, Metrics_SuggestionSelected_CountryOfSelectedIban) {}

TEST_F(IbanManagerTest, Metrics_NoSuggestionShown) {}

}  // namespace autofill