Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1518)

Unified Diff: components/password_manager/core/browser/affiliation_utils_unittest.cc

Issue 1668523002: [Password Manager] Switch password manager code to use the Feature framework. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..332271e1c9f9058990c09a3ea959a1c4133e9d4b 100644
--- a/components/password_manager/core/browser/affiliation_utils_unittest.cc
+++ b/components/password_manager/core/browser/affiliation_utils_unittest.cc
@@ -8,7 +8,6 @@
#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/variations/variations_associated_data.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "url/url_constants.h"
@@ -16,7 +15,6 @@
namespace password_manager {
namespace {
-const char kFieldTrialName[] = "AffiliationBasedMatching";
const std::string kSchemeHostExample = "http://example.com";
const char kTestFacetURI1[] = "https://alpha.example.com/";
const char kTestFacetURI2[] = "https://beta.example.com/";
@@ -200,89 +198,6 @@ TEST(AffiliationUtilsTest, NotEqualEquivalenceClasses) {
EXPECT_FALSE(AreEquivalenceClassesEqual(c, b));
}
-TEST(AffiliationUtilsTest, IsAffiliationBasedMatchingEnabled) {
- struct {
- const char* field_trial_group;
- const char* command_line_switch;
- bool expected_enabled;
- } kTestCases[] = {
- {"", "", true},
- {"", switches::kEnableAffiliationBasedMatching, true},
- {"", switches::kDisableAffiliationBasedMatching, false},
- {"garbage value", "", true},
- {"disabled", "", false},
- {"disabled2", "", false},
- {"Disabled", "", false},
- {"Disabled", switches::kDisableAffiliationBasedMatching, false},
- {"Disabled", switches::kEnableAffiliationBasedMatching, true},
- {"enabled", "", true},
- {"enabled2", "", true},
- {"Enabled", "", true},
- {"Enabled", switches::kDisableAffiliationBasedMatching, false},
- {"Enabled", switches::kEnableAffiliationBasedMatching, true}};
-
- for (const auto& test_case : kTestCases) {
- SCOPED_TRACE(testing::Message("Command line = ")
- << test_case.command_line_switch);
- SCOPED_TRACE(testing::Message("Group name = ")
- << test_case.field_trial_group);
-
- base::FieldTrialList field_trials(nullptr);
- 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));
- }
-}
-
-TEST(AffiliationUtilsTest,
- IsPropagatingPasswordChangesToWebCredentialsEnabled) {
- const char kExperimentName[] = "DoesNotMatter";
-
- struct {
- const char* variation_param;
- const char* command_line_switch;
- bool expected_enabled;
- } kTestCases[] = {
- {"", "", true},
- {"", switches::kEnableAffiliationBasedMatching, true},
- {"", switches::kDisableAffiliationBasedMatching, false},
- {"garbage value", "", true},
- {"disabled", "", false},
- {"Disabled", "", false},
- {"Disabled", switches::kDisableAffiliationBasedMatching, false},
- {"Disabled", switches::kEnableAffiliationBasedMatching, true},
- {"enabled", "", true},
- {"Enabled", "", true},
- {"Enabled", switches::kDisableAffiliationBasedMatching, false},
- {"Enabled", switches::kEnableAffiliationBasedMatching, true}};
-
- for (const auto& test_case : kTestCases) {
- SCOPED_TRACE(testing::Message("Command line = ")
- << test_case.command_line_switch);
- SCOPED_TRACE(testing::Message("Variation param = ")
- << test_case.variation_param);
-
- variations::testing::ClearAllVariationParams();
- base::FieldTrialList field_trials(nullptr);
- base::FieldTrialList::CreateFieldTrial(kFieldTrialName, kExperimentName);
- std::map<std::string, std::string> variation_params;
- variation_params["propagate_password_changes_to_web"] =
- test_case.variation_param;
- 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));
- }
-}
-
class GetHumanReadableOriginTest : public testing::Test {
public:
GetHumanReadableOriginTest() {

Powered by Google App Engine
This is Rietveld 408576698