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

Side by Side Diff: chrome/browser/password_manager/password_manager_browsertest.cc

Issue 2673393002: Don't change the HTTPS PasswordForm::action during HTTP -> HTTPS migration. (Closed)
Patch Set: Created 3 years, 10 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 unified diff | Download patch
« no previous file with comments | « no previous file | components/password_manager/core/browser/http_password_migrator.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <string> 5 #include <string>
6 #include <utility> 6 #include <utility>
7 7
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/memory/ptr_util.h" 10 #include "base/memory/ptr_util.h"
(...skipping 1475 matching lines...) Expand 10 before | Expand all | Expand 10 after
1486 scoped_refptr<password_manager::TestPasswordStore> password_store = 1486 scoped_refptr<password_manager::TestPasswordStore> password_store =
1487 static_cast<password_manager::TestPasswordStore*>( 1487 static_cast<password_manager::TestPasswordStore*>(
1488 PasswordStoreFactory::GetForProfile( 1488 PasswordStoreFactory::GetForProfile(
1489 browser()->profile(), ServiceAccessType::IMPLICIT_ACCESS) 1489 browser()->profile(), ServiceAccessType::IMPLICIT_ACCESS)
1490 .get()); 1490 .get());
1491 EXPECT_FALSE(password_store->IsEmpty()); 1491 EXPECT_FALSE(password_store->IsEmpty());
1492 CheckThatCredentialsStored(password_store.get(), base::ASCIIToUTF16("user"), 1492 CheckThatCredentialsStored(password_store.get(), base::ASCIIToUTF16("user"),
1493 base::ASCIIToUTF16("password")); 1493 base::ASCIIToUTF16("password"));
1494 } 1494 }
1495 1495
1496 // Tests that after HTTP -> HTTPS migration the credential is autofilled.
1497 IN_PROC_BROWSER_TEST_F(PasswordManagerBrowserTestBase,
1498 HttpMigratedCredentialAutofilled) {
1499 net::EmbeddedTestServer https_test_server(
1500 net::EmbeddedTestServer::TYPE_HTTPS);
1501 https_test_server.ServeFilesFromSourceDirectory(
1502 base::FilePath(FILE_PATH_LITERAL("chrome/test/data")));
1503 ASSERT_TRUE(https_test_server.Start());
1504
1505 // Add an http credential to the password store.
1506 GURL https_origin = https_test_server.base_url();
1507 ASSERT_TRUE(https_origin.SchemeIs(url::kHttpsScheme));
1508 GURL::Replacements rep;
1509 rep.SetSchemeStr(url::kHttpScheme);
1510 GURL http_origin = https_origin.ReplaceComponents(rep);
1511 autofill::PasswordForm http_form;
1512 http_form.signon_realm = http_origin.spec();
1513 http_form.origin = http_origin;
1514 // Assume that the previous action was already HTTPS one matching the current
1515 // page.
1516 http_form.action = https_origin;
1517 http_form.username_value = base::ASCIIToUTF16("user");
1518 http_form.password_value = base::ASCIIToUTF16("12345");
1519 scoped_refptr<password_manager::TestPasswordStore> password_store =
1520 static_cast<password_manager::TestPasswordStore*>(
1521 PasswordStoreFactory::GetForProfile(
1522 browser()->profile(), ServiceAccessType::IMPLICIT_ACCESS).get());
1523 password_store->AddLogin(http_form);
1524
1525 NavigationObserver form_observer(WebContents());
1526 ui_test_utils::NavigateToURL(
1527 browser(), https_test_server.GetURL("/password/password_form.html"));
1528 form_observer.Wait();
1529 WaitForPasswordStore();
1530
1531 // Let the user interact with the page, so that DOM gets modification events,
1532 // needed for autofilling fields.
1533 content::SimulateMouseClickAt(
1534 WebContents(), 0, blink::WebMouseEvent::Button::Left, gfx::Point(1, 1));
1535 WaitForElementValue("username_field", "user");
1536 CheckElementValue("password_field", "12345");
1537 }
1538
1496 IN_PROC_BROWSER_TEST_F(PasswordManagerBrowserTestBase, 1539 IN_PROC_BROWSER_TEST_F(PasswordManagerBrowserTestBase,
1497 PromptWhenPasswordFormWithoutUsernameFieldSubmitted) { 1540 PromptWhenPasswordFormWithoutUsernameFieldSubmitted) {
1498 scoped_refptr<password_manager::TestPasswordStore> password_store = 1541 scoped_refptr<password_manager::TestPasswordStore> password_store =
1499 static_cast<password_manager::TestPasswordStore*>( 1542 static_cast<password_manager::TestPasswordStore*>(
1500 PasswordStoreFactory::GetForProfile( 1543 PasswordStoreFactory::GetForProfile(
1501 browser()->profile(), ServiceAccessType::IMPLICIT_ACCESS).get()); 1544 browser()->profile(), ServiceAccessType::IMPLICIT_ACCESS).get());
1502 1545
1503 EXPECT_TRUE(password_store->IsEmpty()); 1546 EXPECT_TRUE(password_store->IsEmpty());
1504 1547
1505 NavigateToFile("/password/form_with_only_password_field.html"); 1548 NavigateToFile("/password/form_with_only_password_field.html");
(...skipping 1654 matching lines...) Expand 10 before | Expand all | Expand 10 after
3160 // about all frames, not just the main one. The factories should receive 3203 // about all frames, not just the main one. The factories should receive
3161 // messages for non-main frames, in particular 3204 // messages for non-main frames, in particular
3162 // AutofillHostMsg_PasswordFormsParsed. If that were the first time the 3205 // AutofillHostMsg_PasswordFormsParsed. If that were the first time the
3163 // factories hear about such frames, this would crash. 3206 // factories hear about such frames, this would crash.
3164 tab_strip_model->AddWebContents(detached_web_contents.release(), -1, 3207 tab_strip_model->AddWebContents(detached_web_contents.release(), -1,
3165 ::ui::PAGE_TRANSITION_AUTO_TOPLEVEL, 3208 ::ui::PAGE_TRANSITION_AUTO_TOPLEVEL,
3166 TabStripModel::ADD_ACTIVE); 3209 TabStripModel::ADD_ACTIVE);
3167 } 3210 }
3168 3211
3169 } // namespace password_manager 3212 } // namespace password_manager
OLDNEW
« no previous file with comments | « no previous file | components/password_manager/core/browser/http_password_migrator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698