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

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

Issue 1090163004: Add experiment to exercise AffiliationService with dummy data, plus add related UMA histograms. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@update_copy
Patch Set: Comment phrasing. Created 5 years, 8 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 f4147844e2682efbbe8f84822a4dc9256931a6ee..73240bc3560c67c78f19fdfe419e9610cd1e3a1a 100644
--- a/components/password_manager/core/browser/affiliation_utils_unittest.cc
+++ b/components/password_manager/core/browser/affiliation_utils_unittest.cc
@@ -280,4 +280,47 @@ TEST(AffiliationUtilsTest,
}
}
+TEST(AffiliationUtilsTest, IsAffiliationRequestsForDummyFacetsEnabled) {
+ const char kExperimentName[] = "DoesNotMatter";
+
+ struct {
+ const char* variation_param;
+ const char* command_line_switch;
+ bool expected_enabled;
+ } kTestCases[] = {
+ {"", "", false},
+ {"", switches::kEnableAffiliationBasedMatching, true},
+ {"", switches::kDisableAffiliationBasedMatching, false},
+ {"garbage value", "", false},
+ {"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["affiliation_requests_for_dummy_facets"] =
+ 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,
+ IsAffiliationRequestsForDummyFacetsEnabled(command_line));
+ }
+}
+
} // namespace password_manager
« no previous file with comments | « components/password_manager/core/browser/affiliation_utils.cc ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698