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

Unified Diff: chrome/browser/password_manager/credential_manager_browsertest.cc

Issue 2210503002: Get rid of the timeouts in CredentialManagerBrowserTest.* (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/password_manager/credential_manager_browsertest.cc
diff --git a/chrome/browser/password_manager/credential_manager_browsertest.cc b/chrome/browser/password_manager/credential_manager_browsertest.cc
index 9660f51e73de4c8c86c3f9b4aea43cb9945e6928..452e5f09f1d6f03f7f5c19207664b49a2455ba40 100644
--- a/chrome/browser/password_manager/credential_manager_browsertest.cc
+++ b/chrome/browser/password_manager/credential_manager_browsertest.cc
@@ -144,15 +144,11 @@ IN_PROC_BROWSER_TEST_F(CredentialManagerBrowserTest,
"document.getElementById('password_field').value = 'trash';";
ASSERT_TRUE(content::ExecuteScript(RenderViewHost(), fill_password));
- // Call the API with a delay to trigger the notification to the client. The
- // delay ensures that parsing password forms won't happen again after the API
- // call making the test flaky.
+ // Call the API to trigger the notification to the client.
ASSERT_TRUE(content::ExecuteScript(
RenderViewHost(),
- "setTimeout( function() {"
- "navigator.credentials.get({password: true})"
- ".then(cred => window.location = '/password/done.html');"
- "}, 1000)"));
+ "navigator.credentials.get({password: true})"
+ ".then(cred => window.location = '/password/done.html');"));
NavigationObserver observer(WebContents());
observer.SetPathToWaitFor("/password/done.html");
@@ -160,31 +156,23 @@ IN_PROC_BROWSER_TEST_F(CredentialManagerBrowserTest,
std::unique_ptr<BubbleObserver> prompt_observer(
new BubbleObserver(WebContents()));
- // The autofill password manager shouldn't react to the successful login.
+ // The autofill password manager shouldn't react to the successful login
+ // because it was suppressed when the site fot the credential back.
kolos1 2016/08/04 09:18:34 fot->got?
vasilii 2016/08/04 09:31:21 Done.
EXPECT_FALSE(prompt_observer->IsShowingSavePrompt());
}
IN_PROC_BROWSER_TEST_F(CredentialManagerBrowserTest, SaveViaAPIAndAutofill) {
NavigateToFile("/password/password_form.html");
- // Postpone a submit event for 1 second. Even for the static html page Chrome
- // continues to parse and recreate the PasswordFormManager instances after the
- // page load. Calling the API before this would make the test flaky. Clicking
- // on the button emulates server analysing the credential and then saving and
- // navigating to the landing page.
ASSERT_TRUE(content::ExecuteScript(
RenderViewHost(),
"document.getElementById('input_submit_button').addEventListener('click',"
"function(event) {"
- "setTimeout( function() {"
- "var c = new PasswordCredential({ id: 'user', password: 'API' });"
- "navigator.credentials.store(c);"
- "document.getElementById('testform').submit();"
- "}, 1000 );"
- "event.preventDefault();"
+ "var c = new PasswordCredential({ id: 'user', password: 'API' });"
+ "navigator.credentials.store(c);"
"});"));
- // Fill the password and click the button to submit the page later. The API
- // should suppress the autofill password manager.
+ // Fill the password and click the button to submit the page. The API should
+ // suppress the autofill password manager.
NavigationObserver form_submit_observer(WebContents());
ASSERT_TRUE(content::ExecuteScript(
RenderViewHost(),
@@ -232,21 +220,12 @@ IN_PROC_BROWSER_TEST_F(CredentialManagerBrowserTest, UpdateViaAPIAndAutofill) {
NavigateToFile("/password/password_form.html");
- // Postpone a submit event for 1 second. Even for the static html page Chrome
- // continues to parse and recreate the PasswordFormManager instances after the
- // page load. Calling the API before this would make the test flaky. Clicking
- // on the button emulates server analysing the credential and then saving and
- // navigating to the landing page.
ASSERT_TRUE(content::ExecuteScript(
RenderViewHost(),
"document.getElementById('input_submit_button').addEventListener('click',"
"function(event) {"
- "setTimeout( function() {"
- "var c = new PasswordCredential({ id: 'user', password: 'API' });"
- "navigator.credentials.store(c);"
- "document.getElementById('testform').submit();"
- "}, 1000 );"
- "event.preventDefault();"
+ "var c = new PasswordCredential({ id: 'user', password: 'API' });"
+ "navigator.credentials.store(c);"
"});"));
// Fill the new password and click the button to submit the page later. The
// API should suppress the autofill password manager and overwrite the
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698