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

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

Issue 451853003: [Password Manager] Setup experiment to restrict autofilling of sync credential (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Unittest fix Created 6 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/core/browser/password_form_manager_unittest.cc
diff --git a/components/password_manager/core/browser/password_form_manager_unittest.cc b/components/password_manager/core/browser/password_form_manager_unittest.cc
index a3399cd47ae732545fd08d488ce8b4c21cd96661..77b7d4c718c8a300065c4824c966dba0203f1328 100644
--- a/components/password_manager/core/browser/password_form_manager_unittest.cc
+++ b/components/password_manager/core/browser/password_form_manager_unittest.cc
@@ -60,6 +60,13 @@ class TestPasswordManagerClient : public StubPasswordManagerClient {
true);
}
+ virtual bool ShouldFilterAutofillResult(
+ const autofill::PasswordForm& form) OVERRIDE {
+ if (form == form_to_filter_)
+ return true;
+ return false;
+ }
+
virtual void PromptUserToSavePassword(
scoped_ptr<PasswordFormManager> form_to_save) OVERRIDE {}
virtual PrefService* GetPrefs() OVERRIDE { return &prefs_; }
@@ -70,9 +77,15 @@ class TestPasswordManagerClient : public StubPasswordManagerClient {
driver_.FillPasswordForm(*fill_data.get());
}
+ void SetFormToFilter(const autofill::PasswordForm& form) {
+ form_to_filter_ = form;
+ }
+
MockPasswordManagerDriver* GetMockDriver() { return &driver_; }
private:
+ autofill::PasswordForm form_to_filter_;
+
TestingPrefServiceSimple prefs_;
PasswordStore* password_store_;
MockPasswordManagerDriver driver_;
@@ -177,7 +190,7 @@ class PasswordFormManagerTest : public testing::Test {
}
bool IgnoredResult(PasswordFormManager* p, PasswordForm* form) {
- return p->IgnoreResult(*form);
+ return p->ShouldIgnoreResult(*form);
}
PasswordForm* observed_form() { return &observed_form_; }
@@ -427,6 +440,10 @@ TEST_F(PasswordFormManagerTest, TestIgnoreResult) {
saved_match()->action = GURL("http://www.google.com/b/Login");
saved_match()->origin = GURL("http://www.google.com/foo");
EXPECT_FALSE(IgnoredResult(&manager, saved_match()));
+
+ // Results should be ignored if the client requests it.
+ client()->SetFormToFilter(*saved_match());
+ EXPECT_TRUE(IgnoredResult(&manager, saved_match()));
}
TEST_F(PasswordFormManagerTest, TestEmptyAction) {

Powered by Google App Engine
This is Rietveld 408576698