Skip to content

Commit

Permalink
Remove CreateForm shortcut in AutofillMetricsTestBase.
Browse files Browse the repository at this point in the history
Bug: 1465839
Change-Id: Ifb281be8548e815294309afb4e3c9a1566aa47a6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4798691
Code-Coverage: findit-for-me@appspot.gserviceaccount.com <findit-for-me@appspot.gserviceaccount.com>
Reviewed-by: Christoph Schwering <schwering@google.com>
Commit-Queue: Jan Keitel <jkeitel@google.com>
Cr-Commit-Position: refs/heads/main@{#1186467}
  • Loading branch information
Jan Keitel authored and Chromium LUCI CQ committed Aug 22, 2023
1 parent 9eac168 commit 051c1de
Show file tree
Hide file tree
Showing 6 changed files with 359 additions and 316 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,14 @@
#include "components/autofill/core/browser/metrics/autofill_metrics_test_base.h"
#include "testing/gtest/include/gtest/gtest.h"

namespace autofill::autofill_metrics {

using ::base::Bucket;
using ::base::BucketsAre;
using test::CreateTestFormField;
using ::testing::NiceMock;
using ::testing::TestWithParam;

namespace autofill::autofill_metrics {

struct TouchToFillForCreditCardsTestCase {
std::vector<ServerFieldType> field_types;
std::vector<bool> fields_have_autofilled_values;
Expand Down Expand Up @@ -59,18 +60,19 @@ class TouchToFillForCreditCardsTest
switch (type) {
case CREDIT_CARD_NAME_FULL:
fields_to_return.emplace_back(
CreateField("Name on card", "cardName", "", "text"));
CreateTestFormField("Name on card", "cardName", "", "text"));
break;
case CREDIT_CARD_NUMBER:
fields_to_return.emplace_back(
CreateField("Credit card number", "cardNumber", "", "text"));
fields_to_return.emplace_back(CreateTestFormField(
"Credit card number", "cardNumber", "", "text"));
break;
case CREDIT_CARD_EXP_MONTH:
fields_to_return.push_back(
CreateField("Expiration date", "cc_exp", "", "text"));
CreateTestFormField("Expiration date", "cc_exp", "", "text"));
break;
case CREDIT_CARD_VERIFICATION_CODE:
fields_to_return.emplace_back(CreateField("CVC", "CVC", "", "text"));
fields_to_return.emplace_back(
CreateTestFormField("CVC", "CVC", "", "text"));
break;
default:
NOTREACHED();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -203,16 +203,6 @@ class AutofillMetricsBaseTest {
return form;
}

// Forwards to test::CreateTestFormField(). This is a hack meant as an
// intermediate step towards removing the out-parameters from
// autofill_form_util.h.
// TODO(crbug.com/1465839): Replace the short-hand by `CreateTestFormField`
// now that that also returns by value.
template <typename... Args>
[[nodiscard]] FormFieldData CreateField(Args... args) {
return test::CreateTestFormField(args...);
}

TestBrowserAutofillManager& autofill_manager() {
return static_cast<TestBrowserAutofillManager&>(
*autofill_driver_->autofill_manager());
Expand Down

0 comments on commit 051c1de

Please sign in to comment.