| Index: chrome/browser/password_manager/password_manager_browsertest.cc
|
| diff --git a/chrome/browser/password_manager/password_manager_browsertest.cc b/chrome/browser/password_manager/password_manager_browsertest.cc
|
| index 6262e0e43ede53bfe66fdf1db8afd3e30d622b5f..f00a9ebbc787fb1155a5f072c648cc4689e1bf2a 100644
|
| --- a/chrome/browser/password_manager/password_manager_browsertest.cc
|
| +++ b/chrome/browser/password_manager/password_manager_browsertest.cc
|
| @@ -1493,6 +1493,49 @@ IN_PROC_BROWSER_TEST_F(
|
| base::ASCIIToUTF16("password"));
|
| }
|
|
|
| +// Tests that after HTTP -> HTTPS migration the credential is autofilled.
|
| +IN_PROC_BROWSER_TEST_F(PasswordManagerBrowserTestBase,
|
| + HttpMigratedCredentialAutofilled) {
|
| + net::EmbeddedTestServer https_test_server(
|
| + net::EmbeddedTestServer::TYPE_HTTPS);
|
| + https_test_server.ServeFilesFromSourceDirectory(
|
| + base::FilePath(FILE_PATH_LITERAL("chrome/test/data")));
|
| + ASSERT_TRUE(https_test_server.Start());
|
| +
|
| + // Add an http credential to the password store.
|
| + GURL https_origin = https_test_server.base_url();
|
| + ASSERT_TRUE(https_origin.SchemeIs(url::kHttpsScheme));
|
| + GURL::Replacements rep;
|
| + rep.SetSchemeStr(url::kHttpScheme);
|
| + GURL http_origin = https_origin.ReplaceComponents(rep);
|
| + autofill::PasswordForm http_form;
|
| + http_form.signon_realm = http_origin.spec();
|
| + http_form.origin = http_origin;
|
| + // Assume that the previous action was already HTTPS one matching the current
|
| + // page.
|
| + http_form.action = https_origin;
|
| + http_form.username_value = base::ASCIIToUTF16("user");
|
| + http_form.password_value = base::ASCIIToUTF16("12345");
|
| + scoped_refptr<password_manager::TestPasswordStore> password_store =
|
| + static_cast<password_manager::TestPasswordStore*>(
|
| + PasswordStoreFactory::GetForProfile(
|
| + browser()->profile(), ServiceAccessType::IMPLICIT_ACCESS).get());
|
| + password_store->AddLogin(http_form);
|
| +
|
| + NavigationObserver form_observer(WebContents());
|
| + ui_test_utils::NavigateToURL(
|
| + browser(), https_test_server.GetURL("/password/password_form.html"));
|
| + form_observer.Wait();
|
| + WaitForPasswordStore();
|
| +
|
| + // Let the user interact with the page, so that DOM gets modification events,
|
| + // needed for autofilling fields.
|
| + content::SimulateMouseClickAt(
|
| + WebContents(), 0, blink::WebMouseEvent::Button::Left, gfx::Point(1, 1));
|
| + WaitForElementValue("username_field", "user");
|
| + CheckElementValue("password_field", "12345");
|
| +}
|
| +
|
| IN_PROC_BROWSER_TEST_F(PasswordManagerBrowserTestBase,
|
| PromptWhenPasswordFormWithoutUsernameFieldSubmitted) {
|
| scoped_refptr<password_manager::TestPasswordStore> password_store =
|
|
|