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

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

Issue 2288203002: Redo PasswordManagerBrowserTestBase.InternalsPage (Closed)
Patch Set: Inline the helper method, update comments Created 4 years, 3 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/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 82a63baea800a9ce793c03e0dc7eb35d6e16942f..aa7282ea34dc624591d5fd91862d96edf2840f8a 100644
--- a/chrome/browser/password_manager/password_manager_browsertest.cc
+++ b/chrome/browser/password_manager/password_manager_browsertest.cc
@@ -2739,39 +2739,63 @@ IN_PROC_BROWSER_TEST_F(PasswordManagerBrowserTestBase,
EXPECT_EQ("mypassword", actual_password);
}
-// Check that the internals page contains logs both from the renderer and the
-// browser.
-IN_PROC_BROWSER_TEST_F(PasswordManagerBrowserTestBase, InternalsPage) {
+// Check that the internals page contains logs from the renderer.
+IN_PROC_BROWSER_TEST_F(PasswordManagerBrowserTestBase, InternalsPage_Renderer) {
+ // Open the internals page.
ui_test_utils::NavigateToURLWithDisposition(
browser(), GURL("chrome://password-manager-internals"),
WindowOpenDisposition::CURRENT_TAB,
ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION);
content::WebContents* internals_web_contents = WebContents();
+ // Open some page with a HTML form.
ui_test_utils::NavigateToURLWithDisposition(
browser(), embedded_test_server()->GetURL("/password/password_form.html"),
WindowOpenDisposition::NEW_FOREGROUND_TAB,
ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION);
+ content::WebContents* forms_web_contents = WebContents();
- std::string find_renderer_logs =
+ // The renderer queries the availability of logging on start-up. However, it
+ // can take too long to propagate that message from the browser back to the
+ // renderer. The renderer might have attempted logging in the meantime.
+ // Therefore the page with the form is reloaded to increase the likelihood
+ // that the availability query was answered before the logging during page
+ // load.
+ NavigationObserver observer(forms_web_contents);
+ forms_web_contents->ReloadFocusedFrame(false);
vabr (Chromium) 2016/09/05 12:36:43 This does not recreate the PasswordAutofillAgent (
+ observer.Wait();
+
+ std::string find_logs =
"var text = document.getElementById('log-entries').innerText;"
"var logs_found = /PasswordAutofillAgent::/.test(text);"
"window.domAutomationController.send(logs_found);";
- bool renderer_logs_found;
+ bool logs_found = false;
ASSERT_TRUE(content::ExecuteScriptAndExtractBool(
- internals_web_contents->GetRenderViewHost(), find_renderer_logs,
- &renderer_logs_found));
- EXPECT_TRUE(renderer_logs_found);
+ internals_web_contents->GetRenderViewHost(), find_logs, &logs_found));
+ EXPECT_TRUE(logs_found);
+}
+
+// Check that the internals page contains logs from the browser.
+IN_PROC_BROWSER_TEST_F(PasswordManagerBrowserTestBase, InternalsPage_Browser) {
+ ui_test_utils::NavigateToURLWithDisposition(
+ browser(), GURL("chrome://password-manager-internals"),
+ WindowOpenDisposition::CURRENT_TAB,
+ ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION);
+ content::WebContents* internals_web_contents = WebContents();
+
+ ui_test_utils::NavigateToURLWithDisposition(
+ browser(), embedded_test_server()->GetURL("/password/password_form.html"),
+ WindowOpenDisposition::NEW_FOREGROUND_TAB,
+ ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION);
- std::string find_browser_logs =
+ std::string find_logs =
"var text = document.getElementById('log-entries').innerText;"
"var logs_found = /PasswordManager::/.test(text);"
"window.domAutomationController.send(logs_found);";
- bool browser_logs_found;
+ bool logs_found = false;
ASSERT_TRUE(content::ExecuteScriptAndExtractBool(
- internals_web_contents->GetRenderViewHost(), find_browser_logs,
- &browser_logs_found));
- EXPECT_TRUE(browser_logs_found);
+ internals_web_contents->GetRenderViewHost(), find_logs, &logs_found));
+ EXPECT_TRUE(logs_found);
}
// Tests that submitted credentials are saved on a password form without
« 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