| Index: components/password_manager/content/browser/content_password_manager_driver_unittest.cc
|
| diff --git a/components/password_manager/content/browser/content_password_manager_driver_unittest.cc b/components/password_manager/content/browser/content_password_manager_driver_unittest.cc
|
| index 06e21b397ded4a8bfb76854026bbb627bbb84071..7bdd57d4cd21f82624fa8d025969eb2e0bed7861 100644
|
| --- a/components/password_manager/content/browser/content_password_manager_driver_unittest.cc
|
| +++ b/components/password_manager/content/browser/content_password_manager_driver_unittest.cc
|
| @@ -10,6 +10,8 @@
|
| #include "components/autofill/core/browser/test_autofill_client.h"
|
| #include "components/password_manager/core/browser/stub_log_manager.h"
|
| #include "components/password_manager/core/browser/stub_password_manager_client.h"
|
| +#include "content/public/browser/navigation_entry.h"
|
| +#include "content/public/browser/ssl_status.h"
|
| #include "content/public/browser/web_contents.h"
|
| #include "content/public/test/test_renderer_host.h"
|
| #include "mojo/public/cpp/bindings/binding.h"
|
| @@ -167,6 +169,35 @@ TEST_P(ContentPasswordManagerDriverTest, AnswerToIPCPingsAboutLoggingState) {
|
| EXPECT_EQ(should_allow_logging, logging_activated);
|
| }
|
|
|
| +// Tests that password visibility notifications are forwarded to the
|
| +// WebContents.
|
| +TEST_P(ContentPasswordManagerDriverTest, PasswordVisibility) {
|
| + std::unique_ptr<ContentPasswordManagerDriver> driver(
|
| + new ContentPasswordManagerDriver(main_rfh(), &password_manager_client_,
|
| + &autofill_client_));
|
| +
|
| + // Do a mock navigation so that there is a navigation entry on which
|
| + // password visibility gets recorded.
|
| + GURL url("http://example.test");
|
| + NavigateAndCommit(url);
|
| + content::NavigationEntry* entry =
|
| + web_contents()->GetController().GetVisibleEntry();
|
| + ASSERT_TRUE(entry);
|
| + EXPECT_EQ(url, entry->GetURL());
|
| + EXPECT_FALSE(!!(entry->GetSSL().content_status &
|
| + content::SSLStatus::DISPLAYED_PASSWORD_FIELD_ON_HTTP));
|
| +
|
| + driver->PasswordFieldVisibleInInsecureContext();
|
| +
|
| + // Check that the password visibility notification was passed on to
|
| + // the WebContents (and from there to the SSLStatus).
|
| + entry = web_contents()->GetController().GetVisibleEntry();
|
| + ASSERT_TRUE(entry);
|
| + EXPECT_EQ(url, entry->GetURL());
|
| + EXPECT_TRUE(!!(entry->GetSSL().content_status &
|
| + content::SSLStatus::DISPLAYED_PASSWORD_FIELD_ON_HTTP));
|
| +}
|
| +
|
| INSTANTIATE_TEST_CASE_P(,
|
| ContentPasswordManagerDriverTest,
|
| testing::Values(true, false));
|
|
|