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

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

Issue 2604453003: Show Form-Not-Secure warning on page load (Closed)
Patch Set: meacer, jochen comments Created 3 years, 12 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 b86d9f0434cd03d9ca251c9b3f03d294173d6d8f..37691c5dd2302bde9a28f37ecfbd0c509fd67fcd 100644
--- a/components/password_manager/core/browser/password_form_manager_unittest.cc
+++ b/components/password_manager/core/browser/password_form_manager_unittest.cc
@@ -39,6 +39,7 @@
#include "components/prefs/pref_registry_simple.h"
#include "components/prefs/pref_service.h"
#include "components/prefs/testing_pref_service.h"
+#include "components/security_state/core/security_state.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "url/gurl.h"
@@ -2854,4 +2855,41 @@ TEST_F(PasswordFormManagerTest, RemoveResultsWithWrongScheme_ObservingHTML) {
}
}
+class PasswordFormManagerFormNotSecureTest : public PasswordFormManagerTest {
+ public:
+ PasswordFormManagerFormNotSecureTest() {
+ scoped_feature_list_.InitAndEnableFeature(
+ security_state::kHttpFormWarningFeature);
+ }
+
+ base::test::ScopedFeatureList scoped_feature_list_;
+};
+
+// Tests that PasswordFormFillData's
+// |show_form_not_secure_warning_on_autofill| field is set correctly
+// when processing a frame.
+TEST_F(PasswordFormManagerFormNotSecureTest,
+ ProcessFrameSetsFormNotSecureFlag) {
+ autofill::PasswordFormFillData fill_data;
+ EXPECT_CALL(*client()->mock_driver(), FillPasswordForm(_))
+ .WillOnce(SaveArg<0>(&fill_data));
+ fake_form_fetcher()->SetNonFederated({saved_match()}, 0u);
+ EXPECT_TRUE(fill_data.show_form_not_secure_warning_on_autofill);
+}
+
+// Tests that PasswordFormFillData's
+// |show_form_not_secure_warning_on_autofill| field is *not* set when
+// the feature is not enabled.
+//
+// TODO(estark): remove this test when the feature is fully
+// launched. https://crbug.com/677295
+TEST_F(PasswordFormManagerTest,
+ ProcessFrameSetsFormNotSecureFlagWithoutFeature) {
+ autofill::PasswordFormFillData fill_data;
+ EXPECT_CALL(*client()->mock_driver(), FillPasswordForm(_))
+ .WillOnce(SaveArg<0>(&fill_data));
+ fake_form_fetcher()->SetNonFederated({saved_match()}, 0u);
+ EXPECT_FALSE(fill_data.show_form_not_secure_warning_on_autofill);
+}
+
} // namespace password_manager

Powered by Google App Engine
This is Rietveld 408576698