| 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
|
|
|