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

Unified Diff: components/password_manager/sync/browser/sync_credentials_filter_unittest.cc

Issue 2226063002: Add a ScopedFeatureList class for testing and start using it. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix issue in previous patchset. Created 4 years, 4 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/sync/browser/sync_credentials_filter_unittest.cc
diff --git a/components/password_manager/sync/browser/sync_credentials_filter_unittest.cc b/components/password_manager/sync/browser/sync_credentials_filter_unittest.cc
index 843fde9d5283dce0b81b7e7ced481f850625967d..c4eca6181a65758181a2106d269bf8d11652eaf6 100644
--- a/components/password_manager/sync/browser/sync_credentials_filter_unittest.cc
+++ b/components/password_manager/sync/browser/sync_credentials_filter_unittest.cc
@@ -12,6 +12,7 @@
#include "base/bind_helpers.h"
#include "base/macros.h"
#include "base/test/histogram_tester.h"
+#include "base/test/scoped_feature_list.h"
#include "base/test/user_action_tester.h"
#include "components/autofill/core/common/password_form.h"
#include "components/password_manager/core/browser/password_manager_test_utils.h"
@@ -138,12 +139,10 @@ TEST_F(CredentialsFilterTest, FilterResults_AllowAll) {
TEST_F(CredentialsFilterTest, FilterResults_DisallowSyncOnReauth) {
// Only 'protect-sync-credential-on-reauth' feature is kept enabled, fill the
// sync credential everywhere but on reauth.
- std::unique_ptr<base::FeatureList> feature_list(new base::FeatureList);
- std::vector<const base::Feature*> enabled_features;
- std::vector<const base::Feature*> disabled_features;
- disabled_features.push_back(&features::kProtectSyncCredential);
- enabled_features.push_back(&features::kProtectSyncCredentialOnReauth);
- SetFeatures(enabled_features, disabled_features, std::move(feature_list));
+ base::test::ScopedFeatureList scoped_feature_list;
+ scoped_feature_list.InitFromCommandLine(
+ features::kProtectSyncCredentialOnReauth.name,
+ features::kProtectSyncCredential.name);
const TestCase kTestCases[] = {
// Reauth URL, not sync username.
@@ -184,12 +183,11 @@ TEST_F(CredentialsFilterTest, FilterResults_DisallowSyncOnReauth) {
TEST_F(CredentialsFilterTest, FilterResults_DisallowSync) {
// Both features are kept enabled, should cause sync credential to be
// filtered.
- std::unique_ptr<base::FeatureList> feature_list(new base::FeatureList);
- std::vector<const base::Feature*> enabled_features;
- std::vector<const base::Feature*> disabled_features;
- enabled_features.push_back(&features::kProtectSyncCredential);
- enabled_features.push_back(&features::kProtectSyncCredentialOnReauth);
- SetFeatures(enabled_features, disabled_features, std::move(feature_list));
+ base::test::ScopedFeatureList scoped_feature_list;
+ scoped_feature_list.InitFromCommandLine(
+ features::kProtectSyncCredential.name + std::string(",") +
+ features::kProtectSyncCredentialOnReauth.name,
+ std::string());
const TestCase kTestCases[] = {
// Reauth URL, not sync username.
@@ -262,12 +260,11 @@ TEST_F(CredentialsFilterTest, ShouldSave_SyncCredential_NotSyncingPasswords) {
TEST_F(CredentialsFilterTest, ShouldFilterOneForm) {
// Both features are kept enabled, should cause sync credential to be
// filtered.
- std::unique_ptr<base::FeatureList> feature_list(new base::FeatureList);
- std::vector<const base::Feature*> enabled_features;
- std::vector<const base::Feature*> disabled_features;
- enabled_features.push_back(&features::kProtectSyncCredential);
- enabled_features.push_back(&features::kProtectSyncCredentialOnReauth);
- SetFeatures(enabled_features, disabled_features, std::move(feature_list));
+ base::test::ScopedFeatureList scoped_feature_list;
+ scoped_feature_list.InitFromCommandLine(
+ features::kProtectSyncCredential.name + std::string(",") +
+ features::kProtectSyncCredentialOnReauth.name,
+ std::string());
ScopedVector<autofill::PasswordForm> results;
results.push_back(new PasswordForm(SimpleGaiaForm("test1@gmail.com")));
« no previous file with comments | « components/password_manager/core/browser/password_manager_unittest.cc ('k') | components/ssl_config/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698