Commit 9a6fe061 authored by Jeffrey Cohen's avatar Jeffrey Cohen Committed by Commit Bot

added basic unit test around AutofillEnableCompanyName feature flag

Bug: 864612
Change-Id: I353668033e7144714fdfc8327f9cd46962e0b22c
Reviewed-on: https://chromium-review.googlesource.com/1176737Reviewed-by: default avatarMoe Ahmadi <mahmadi@chromium.org>
Reviewed-by: default avatarRoger McFarlane <rogerm@chromium.org>
Commit-Queue: Jeffrey Cohen <jeffreycohen@chromium.org>
Cr-Commit-Position: refs/heads/master@{#584062}
parent 01c23806
......@@ -11,8 +11,10 @@
#include "base/strings/string_util.h"
#include "base/strings/stringprintf.h"
#include "base/strings/utf_string_conversions.h"
#include "base/test/scoped_feature_list.h"
#include "components/autofill/core/browser/autofill_type.h"
#include "components/autofill/core/browser/field_types.h"
#include "components/autofill/core/common/autofill_features.h"
#include "testing/gtest/include/gtest/gtest.h"
using base::ASCIIToUTF16;
......@@ -397,4 +399,30 @@ INSTANTIATE_TEST_CASE_P(
NamePartsAreEmptyTestCase{"", "Mitchell", "", "", false},
NamePartsAreEmptyTestCase{"", "", "Morrison", "", false}));
struct CompanyNameEnabledDisabledTest : public testing::TestWithParam<bool> {
CompanyNameEnabledDisabledTest() : feature_state(GetParam()) {
feature_list_.InitWithFeatureState(features::kAutofillEnableCompanyName,
feature_state);
}
const bool feature_state;
private:
base::test::ScopedFeatureList feature_list_;
};
TEST_P(CompanyNameEnabledDisabledTest, GetInfo) {
SCOPED_TRACE(feature_state ? "Enabled" : "Disabled");
const char kCompanyName[] = "Google";
CompanyInfo company;
company.SetInfo(AutofillType(COMPANY_NAME), ASCIIToUTF16(kCompanyName),
"en-US");
EXPECT_EQ(ASCIIToUTF16(feature_state ? kCompanyName : ""),
company.GetInfo(AutofillType(COMPANY_NAME), "en-US"));
}
INSTANTIATE_TEST_CASE_P(ContactInfoTest,
CompanyNameEnabledDisabledTest,
testing::Bool());
} // namespace autofill
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