| OLD | NEW |
| 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 1281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1292 | 1292 |
| 1293 std::string show_form = | 1293 std::string show_form = |
| 1294 "document.getElementsByTagName('form')[0].style.display = 'block'"; | 1294 "document.getElementsByTagName('form')[0].style.display = 'block'"; |
| 1295 ASSERT_TRUE(content::ExecuteScript(RenderViewHost(), show_form)); | 1295 ASSERT_TRUE(content::ExecuteScript(RenderViewHost(), show_form)); |
| 1296 | 1296 |
| 1297 // Wait until the username is filled, to make sure autofill kicked in. | 1297 // Wait until the username is filled, to make sure autofill kicked in. |
| 1298 WaitForElementValue("username", "admin"); | 1298 WaitForElementValue("username", "admin"); |
| 1299 CheckElementValue("password", "12345"); | 1299 CheckElementValue("password", "12345"); |
| 1300 } | 1300 } |
| 1301 | 1301 |
| 1302 // https://crbug.com/713645 |
| 1303 // Navigate to a page that can't load some of the subresources. Create a hidden |
| 1304 // form when the body is loaded. Make the form visible. Chrome should autofill |
| 1305 // the form. |
| 1306 // The fact that the form is hidden isn't super important but reproduces the |
| 1307 // actual bug. |
| 1308 IN_PROC_BROWSER_TEST_F(PasswordManagerBrowserTestBase, SlowPageFill) { |
| 1309 // At first let us save a credential to the password store. |
| 1310 scoped_refptr<password_manager::TestPasswordStore> password_store = |
| 1311 static_cast<password_manager::TestPasswordStore*>( |
| 1312 PasswordStoreFactory::GetForProfile( |
| 1313 browser()->profile(), ServiceAccessType::IMPLICIT_ACCESS) |
| 1314 .get()); |
| 1315 autofill::PasswordForm signin_form; |
| 1316 signin_form.signon_realm = embedded_test_server()->base_url().spec(); |
| 1317 signin_form.origin = embedded_test_server()->base_url(); |
| 1318 signin_form.action = embedded_test_server()->base_url(); |
| 1319 signin_form.username_value = base::ASCIIToUTF16("admin"); |
| 1320 signin_form.password_value = base::ASCIIToUTF16("12345"); |
| 1321 password_store->AddLogin(signin_form); |
| 1322 |
| 1323 GURL url = |
| 1324 embedded_test_server()->GetURL("/password/infinite_password_form.html"); |
| 1325 ui_test_utils::NavigateToURLWithDisposition( |
| 1326 browser(), url, WindowOpenDisposition::CURRENT_TAB, |
| 1327 ui_test_utils::BROWSER_TEST_NONE); |
| 1328 |
| 1329 // Wait for autofill. |
| 1330 BubbleObserver bubble_observer(WebContents()); |
| 1331 bubble_observer.WaitForManagementState(); |
| 1332 |
| 1333 // Show the form and make sure that the password was autofilled. |
| 1334 std::string show_form = |
| 1335 "document.getElementsByTagName('form')[0].style.display = 'block'"; |
| 1336 ASSERT_TRUE(content::ExecuteScript(RenderViewHost(), show_form)); |
| 1337 |
| 1338 CheckElementValue("username", "admin"); |
| 1339 CheckElementValue("password", "12345"); |
| 1340 } |
| 1341 |
| 1302 // Test that if there was no previous page load then the PasswordManagerDriver | 1342 // Test that if there was no previous page load then the PasswordManagerDriver |
| 1303 // does not think that there were SSL errors on the current page. The test opens | 1343 // does not think that there were SSL errors on the current page. The test opens |
| 1304 // a new tab with a URL for which the embedded test server issues a basic auth | 1344 // a new tab with a URL for which the embedded test server issues a basic auth |
| 1305 // challenge. | 1345 // challenge. |
| 1306 IN_PROC_BROWSER_TEST_F(PasswordManagerBrowserTestBase, NoLastLoadGoodLastLoad) { | 1346 IN_PROC_BROWSER_TEST_F(PasswordManagerBrowserTestBase, NoLastLoadGoodLastLoad) { |
| 1307 // We must use a new test server here because embedded_test_server() is | 1347 // We must use a new test server here because embedded_test_server() is |
| 1308 // already started at this point and adding the request handler to it would | 1348 // already started at this point and adding the request handler to it would |
| 1309 // not be thread safe. | 1349 // not be thread safe. |
| 1310 net::EmbeddedTestServer http_test_server; | 1350 net::EmbeddedTestServer http_test_server; |
| 1311 | 1351 |
| (...skipping 2023 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3335 // Force a round-trip. | 3375 // Force a round-trip. |
| 3336 ASSERT_TRUE(content::ExecuteScriptWithoutUserGesture(RenderFrameHost(), | 3376 ASSERT_TRUE(content::ExecuteScriptWithoutUserGesture(RenderFrameHost(), |
| 3337 "var noop = 'noop';")); | 3377 "var noop = 'noop';")); |
| 3338 // Ensure the warning was not triggered. | 3378 // Ensure the warning was not triggered. |
| 3339 ASSERT_FALSE(observing_autofill_client->DidPopupAppear()); | 3379 ASSERT_FALSE(observing_autofill_client->DidPopupAppear()); |
| 3340 // Ensure the histogram remains empty. | 3380 // Ensure the histogram remains empty. |
| 3341 histograms.ExpectTotalCount(kHistogram, 0); | 3381 histograms.ExpectTotalCount(kHistogram, 0); |
| 3342 } | 3382 } |
| 3343 | 3383 |
| 3344 } // namespace password_manager | 3384 } // namespace password_manager |
| OLD | NEW |