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

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

Issue 773823002: PasswordManager should trigger autofill for new forms + old PasswordFromManagers (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Don't duplicate the blacklist & generation IPC Created 6 years 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 | chrome/test/data/password/dynamic_password_form.html » ('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 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/metrics/histogram_samples.h" 8 #include "base/metrics/histogram_samples.h"
9 #include "base/metrics/statistics_recorder.h" 9 #include "base/metrics/statistics_recorder.h"
10 #include "base/path_service.h" 10 #include "base/path_service.h"
(...skipping 1297 matching lines...) Expand 10 before | Expand all | Expand 10 after
1308 NavigateToFile("/password/form_with_only_password_field.html"); 1308 NavigateToFile("/password/form_with_only_password_field.html");
1309 1309
1310 // Let the user interact with the page, so that DOM gets modification events, 1310 // Let the user interact with the page, so that DOM gets modification events,
1311 // needed for autofilling fields. 1311 // needed for autofilling fields.
1312 content::SimulateMouseClickAt( 1312 content::SimulateMouseClickAt(
1313 WebContents(), 0, blink::WebMouseEvent::ButtonLeft, gfx::Point(1, 1)); 1313 WebContents(), 0, blink::WebMouseEvent::ButtonLeft, gfx::Point(1, 1));
1314 1314
1315 // Wait until that interaction causes the password value to be revealed. 1315 // Wait until that interaction causes the password value to be revealed.
1316 WaitForElementValue("password", "mypassword"); 1316 WaitForElementValue("password", "mypassword");
1317 } 1317 }
1318
1319 // Test that if a form gets autofilled, then it gets autofilled on re-creation
1320 // as well.
1321 IN_PROC_BROWSER_TEST_F(PasswordManagerBrowserTest, ReCreatedFormsGetFilled) {
1322 NavigateToFile("/password/dynamic_password_form.html");
1323
1324 // Fill in the credentials, and make sure they are saved.
1325 NavigationObserver form_submit_observer(WebContents());
1326 scoped_ptr<PromptObserver> prompt_observer(
1327 PromptObserver::Create(WebContents()));
1328 std::string create_fill_and_submit =
1329 "document.getElementById('create_form_button').click();"
1330 "window.setTimeout(function() {"
1331 " var form = document.getElementById('dynamic_form_id');"
1332 " form.username.value = 'temp';"
1333 " form.password.value = 'random';"
1334 " form.submit();"
1335 "}, 0)";
1336 ASSERT_TRUE(content::ExecuteScript(RenderViewHost(), create_fill_and_submit));
1337 form_submit_observer.Wait();
1338 EXPECT_TRUE(prompt_observer->IsShowingPrompt());
1339 prompt_observer->Accept();
1340
1341 // Reload the original page to have the saved credentials autofilled.
1342 NavigationObserver reload_observer(WebContents());
1343 NavigateToFile("/password/dynamic_password_form.html");
1344 reload_observer.Wait();
1345 std::string create_form =
1346 "document.getElementById('create_form_button').click();";
1347 ASSERT_TRUE(content::ExecuteScript(RenderViewHost(), create_form));
1348 // Wait until the username is filled, to make sure autofill kicked in.
1349 WaitForElementValue("username_id", "temp");
1350
1351 // Now the form gets deleted and created again. It should get autofilled
1352 // again.
1353 std::string delete_form =
1354 "var form = document.getElementById('dynamic_form_id');"
1355 "form.parentNode.removeChild(form);";
1356 ASSERT_TRUE(content::ExecuteScript(RenderViewHost(), delete_form));
1357 ASSERT_TRUE(content::ExecuteScript(RenderViewHost(), create_form));
1358 WaitForElementValue("username_id", "temp");
1359 }
OLDNEW
« no previous file with comments | « no previous file | chrome/test/data/password/dynamic_password_form.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698