Commit aa606971 authored by Mikel Astiz's avatar Mikel Astiz Committed by Commit Bot

Do not instantiate base::FieldTrialList explicitly in tests

The test suite already instantiates a FieldTrialList as per
https://chromium-review.googlesource.com/c/chromium/src/+/1883567 so
it's no longer necessary to do so explicitly in tests.

This patch addresses unit tests under:
/components/autofill/core/browser

This CL was uploaded by git cl split.

R=parastoog@google.com

Bug: 1018667
Change-Id: I6b3dd0ae0eb6b701e10c1102227cabc7b027742d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1916823
Auto-Submit: Mikel Astiz <mastiz@chromium.org>
Reviewed-by: default avatarParastoo Geranmayeh <parastoog@google.com>
Commit-Queue: Mikel Astiz <mastiz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#715273}
parent 121f47f1
......@@ -25,7 +25,6 @@
#include "components/autofill/core/common/form_field_data.h"
#include "components/autofill/core/common/password_form.h"
#include "components/autofill/core/common/signatures_util.h"
#include "components/variations/entropy_provider.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "url/gurl.h"
......@@ -131,19 +130,22 @@ class FormStructureTest : public testing::Test {
return form_structure.ShouldBeUploaded();
}
void DisableAutofillMetadataFieldTrial() { field_trial_list_.reset(); }
void DisableAutofillMetadataFieldTrial() {
field_trial_ = nullptr;
scoped_feature_list_.Reset();
scoped_feature_list_.Init();
}
private:
void EnableAutofillMetadataFieldTrial() {
field_trial_list_.reset();
field_trial_list_.reset(new base::FieldTrialList(
std::make_unique<variations::SHA1EntropyProvider>("foo")));
scoped_feature_list_.Reset();
scoped_feature_list_.Init();
field_trial_ = base::FieldTrialList::CreateFieldTrial(
"AutofillFieldMetadata", "Enabled");
field_trial_->group();
}
std::unique_ptr<base::FieldTrialList> field_trial_list_;
base::test::ScopedFeatureList scoped_feature_list_;
scoped_refptr<base::FieldTrial> field_trial_;
};
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment