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

Unified Diff: components/password_manager/sync/browser/sync_credentials_filter_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, 10 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
« no previous file with comments | « components/password_manager/sync/browser/sync_credentials_filter.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 cc43857f56f56f3d40e60d7a36ccf667d97bc4f3..546d9c1f9195ed4fd7711ff3f69472402b1ad855 100644
--- a/components/password_manager/sync/browser/sync_credentials_filter_unittest.cc
+++ b/components/password_manager/sync/browser/sync_credentials_filter_unittest.cc
@@ -9,13 +9,12 @@
#include "base/bind.h"
#include "base/bind_helpers.h"
-#include "base/command_line.h"
#include "base/macros.h"
#include "base/test/histogram_tester.h"
#include "base/test/user_action_tester.h"
#include "components/autofill/core/common/password_form.h"
#include "components/password_manager/core/browser/stub_password_manager_client.h"
-#include "components/password_manager/core/common/password_manager_switches.h"
+#include "components/password_manager/core/common/password_manager_features.h"
#include "components/password_manager/sync/browser/sync_username_test_base.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -48,6 +47,14 @@ bool IsFormFiltered(const CredentialsFilter* filter, const PasswordForm& form) {
return vector.empty();
}
+void EnableFeature(const base::Feature& feature) {
vabr (Chromium) 2016/02/08 14:16:49 optional: Instead of duplicating it here and in th
Pritam Nikam 2016/02/08 15:27:19 Done.
+ // Enable the command-line feature.
+ base::FeatureList::ClearInstanceForTesting();
+ scoped_ptr<base::FeatureList> feature_list(new base::FeatureList);
+ feature_list->InitializeFromCommandLine(feature.name, "");
+ base::FeatureList::SetInstance(std::move(feature_list));
+}
+
} // namespace
class CredentialsFilterTest : public SyncUsernameTestBase {
@@ -135,9 +142,7 @@ TEST_F(CredentialsFilterTest, FilterResults_AllowAll) {
}
TEST_F(CredentialsFilterTest, FilterResults_DisallowSyncOnReauth) {
- base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
- command_line->AppendSwitch(
- switches::kDisallowAutofillSyncCredentialForReauth);
+ EnableFeature(features::kDisallowAutofillSyncCredentialForReauth);
const TestCase kTestCases[] = {
// Reauth URL, not sync username.
@@ -176,8 +181,7 @@ TEST_F(CredentialsFilterTest, FilterResults_DisallowSyncOnReauth) {
}
TEST_F(CredentialsFilterTest, FilterResults_DisallowSync) {
- base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
- command_line->AppendSwitch(switches::kDisallowAutofillSyncCredential);
+ EnableFeature(features::kDisallowAutofillSyncCredential);
const TestCase kTestCases[] = {
// Reauth URL, not sync username.
@@ -249,8 +253,7 @@ TEST_F(CredentialsFilterTest, ShouldSave_SyncCredential_NotSyncingPasswords) {
TEST_F(CredentialsFilterTest, ShouldFilterOneForm) {
// Adding disallow switch should cause sync credential to be filtered.
- base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
- command_line->AppendSwitch(switches::kDisallowAutofillSyncCredential);
+ EnableFeature(features::kDisallowAutofillSyncCredential);
ScopedVector<autofill::PasswordForm> results;
results.push_back(new PasswordForm(SimpleGaiaForm("test1@gmail.com")));
« no previous file with comments | « components/password_manager/sync/browser/sync_credentials_filter.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698