| Index: components/password_manager/core/browser/affiliation_utils_unittest.cc
|
| diff --git a/components/password_manager/core/browser/affiliation_utils_unittest.cc b/components/password_manager/core/browser/affiliation_utils_unittest.cc
|
| index f8f32ec4f667c5fdb0974bbf5520962b7ea58cdd..3752d730902cbf46d6e9f2314f7e2d55aa61a29b 100644
|
| --- a/components/password_manager/core/browser/affiliation_utils_unittest.cc
|
| +++ b/components/password_manager/core/browser/affiliation_utils_unittest.cc
|
| @@ -4,11 +4,11 @@
|
|
|
| #include "components/password_manager/core/browser/affiliation_utils.h"
|
|
|
| -#include "base/command_line.h"
|
| #include "base/metrics/field_trial.h"
|
| #include "base/strings/utf_string_conversions.h"
|
| #include "components/autofill/core/common/password_form.h"
|
| -#include "components/password_manager/core/common/password_manager_switches.h"
|
| +#include "components/password_manager/core/browser/password_manager_test_utils.h"
|
| +#include "components/password_manager/core/common/password_manager_features.h"
|
| #include "components/variations/variations_associated_data.h"
|
| #include "testing/gtest/include/gtest/gtest.h"
|
| #include "url/url_constants.h"
|
| @@ -203,27 +203,27 @@ TEST(AffiliationUtilsTest, NotEqualEquivalenceClasses) {
|
| TEST(AffiliationUtilsTest, IsAffiliationBasedMatchingEnabled) {
|
| struct {
|
| const char* field_trial_group;
|
| - const char* command_line_switch;
|
| + const char* command_line_feature;
|
| bool expected_enabled;
|
| } kTestCases[] = {
|
| {"", "", true},
|
| - {"", switches::kEnableAffiliationBasedMatching, true},
|
| - {"", switches::kDisableAffiliationBasedMatching, false},
|
| + {"", features::kEnableAffiliationBasedMatching.name, true},
|
| + {"", features::kDisableAffiliationBasedMatching.name, false},
|
| {"garbage value", "", true},
|
| {"disabled", "", false},
|
| {"disabled2", "", false},
|
| {"Disabled", "", false},
|
| - {"Disabled", switches::kDisableAffiliationBasedMatching, false},
|
| - {"Disabled", switches::kEnableAffiliationBasedMatching, true},
|
| + {"Disabled", features::kDisableAffiliationBasedMatching.name, false},
|
| + {"Disabled", features::kEnableAffiliationBasedMatching.name, true},
|
| {"enabled", "", true},
|
| {"enabled2", "", true},
|
| {"Enabled", "", true},
|
| - {"Enabled", switches::kDisableAffiliationBasedMatching, false},
|
| - {"Enabled", switches::kEnableAffiliationBasedMatching, true}};
|
| + {"Enabled", features::kDisableAffiliationBasedMatching.name, false},
|
| + {"Enabled", features::kEnableAffiliationBasedMatching.name, true}};
|
|
|
| for (const auto& test_case : kTestCases) {
|
| SCOPED_TRACE(testing::Message("Command line = ")
|
| - << test_case.command_line_switch);
|
| + << test_case.command_line_feature);
|
| SCOPED_TRACE(testing::Message("Group name = ")
|
| << test_case.field_trial_group);
|
|
|
| @@ -231,10 +231,9 @@ TEST(AffiliationUtilsTest, IsAffiliationBasedMatchingEnabled) {
|
| base::FieldTrialList::CreateFieldTrial(kFieldTrialName,
|
| test_case.field_trial_group);
|
|
|
| - base::CommandLine command_line(base::CommandLine::NO_PROGRAM);
|
| - command_line.AppendSwitch(test_case.command_line_switch);
|
| - EXPECT_EQ(test_case.expected_enabled,
|
| - IsAffiliationBasedMatchingEnabled(command_line));
|
| + // Enable the command-line feature.
|
| + EnableFeature(test_case.command_line_feature);
|
| + EXPECT_EQ(test_case.expected_enabled, IsAffiliationBasedMatchingEnabled());
|
| }
|
| }
|
|
|
| @@ -244,25 +243,25 @@ TEST(AffiliationUtilsTest,
|
|
|
| struct {
|
| const char* variation_param;
|
| - const char* command_line_switch;
|
| + const char* command_line_feature;
|
| bool expected_enabled;
|
| } kTestCases[] = {
|
| {"", "", true},
|
| - {"", switches::kEnableAffiliationBasedMatching, true},
|
| - {"", switches::kDisableAffiliationBasedMatching, false},
|
| + {"", features::kEnableAffiliationBasedMatching.name, true},
|
| + {"", features::kDisableAffiliationBasedMatching.name, false},
|
| {"garbage value", "", true},
|
| {"disabled", "", false},
|
| {"Disabled", "", false},
|
| - {"Disabled", switches::kDisableAffiliationBasedMatching, false},
|
| - {"Disabled", switches::kEnableAffiliationBasedMatching, true},
|
| + {"Disabled", features::kDisableAffiliationBasedMatching.name, false},
|
| + {"Disabled", features::kEnableAffiliationBasedMatching.name, true},
|
| {"enabled", "", true},
|
| {"Enabled", "", true},
|
| - {"Enabled", switches::kDisableAffiliationBasedMatching, false},
|
| - {"Enabled", switches::kEnableAffiliationBasedMatching, true}};
|
| + {"Enabled", features::kDisableAffiliationBasedMatching.name, false},
|
| + {"Enabled", features::kEnableAffiliationBasedMatching.name, true}};
|
|
|
| for (const auto& test_case : kTestCases) {
|
| SCOPED_TRACE(testing::Message("Command line = ")
|
| - << test_case.command_line_switch);
|
| + << test_case.command_line_feature);
|
| SCOPED_TRACE(testing::Message("Variation param = ")
|
| << test_case.variation_param);
|
|
|
| @@ -275,11 +274,10 @@ TEST(AffiliationUtilsTest,
|
| ASSERT_TRUE(variations::AssociateVariationParams(
|
| kFieldTrialName, kExperimentName, variation_params));
|
|
|
| - base::CommandLine command_line(base::CommandLine::NO_PROGRAM);
|
| - command_line.AppendSwitch(test_case.command_line_switch);
|
| - EXPECT_EQ(
|
| - test_case.expected_enabled,
|
| - IsPropagatingPasswordChangesToWebCredentialsEnabled(command_line));
|
| + // Enable the command-line feature.
|
| + EnableFeature(test_case.command_line_feature);
|
| + EXPECT_EQ(test_case.expected_enabled,
|
| + IsPropagatingPasswordChangesToWebCredentialsEnabled());
|
| }
|
| }
|
|
|
|
|