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 | 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 2716 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2727 | 2727 |
2728 std::string get_password = | 2728 std::string get_password = |
2729 "window.domAutomationController.send(" | 2729 "window.domAutomationController.send(" |
2730 " document.getElementById('hidden_password_form').elements[2].value);"; | 2730 " document.getElementById('hidden_password_form').elements[2].value);"; |
2731 std::string actual_password; | 2731 std::string actual_password; |
2732 ASSERT_TRUE(content::ExecuteScriptAndExtractString( | 2732 ASSERT_TRUE(content::ExecuteScriptAndExtractString( |
2733 RenderViewHost(), get_password, &actual_password)); | 2733 RenderViewHost(), get_password, &actual_password)); |
2734 EXPECT_EQ("mypassword", actual_password); | 2734 EXPECT_EQ("mypassword", actual_password); |
2735 } | 2735 } |
2736 | 2736 |
| 2737 // Check that the internals page contains logs both from the renderer and the |
| 2738 // browser. |
| 2739 IN_PROC_BROWSER_TEST_F(PasswordManagerBrowserTestBase, InternalsPage) { |
| 2740 ui_test_utils::NavigateToURLWithDisposition( |
| 2741 browser(), GURL("chrome://password-manager-internals"), CURRENT_TAB, |
| 2742 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); |
| 2743 content::WebContents* internals_web_contents = WebContents(); |
| 2744 |
| 2745 ui_test_utils::NavigateToURLWithDisposition( |
| 2746 browser(), embedded_test_server()->GetURL("/password/password_form.html"), |
| 2747 NEW_FOREGROUND_TAB, ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); |
| 2748 |
| 2749 std::string find_renderer_logs = |
| 2750 "var text = document.getElementById('log-entries').innerText;" |
| 2751 "var logs_found = /PasswordAutofillAgent::/.test(text);" |
| 2752 "window.domAutomationController.send(logs_found);"; |
| 2753 bool renderer_logs_found; |
| 2754 ASSERT_TRUE(content::ExecuteScriptAndExtractBool( |
| 2755 internals_web_contents->GetRenderViewHost(), find_renderer_logs, |
| 2756 &renderer_logs_found)); |
| 2757 EXPECT_TRUE(renderer_logs_found); |
| 2758 |
| 2759 std::string find_browser_logs = |
| 2760 "var text = document.getElementById('log-entries').innerText;" |
| 2761 "var logs_found = /PasswordManager::/.test(text);" |
| 2762 "window.domAutomationController.send(logs_found);"; |
| 2763 bool browser_logs_found; |
| 2764 ASSERT_TRUE(content::ExecuteScriptAndExtractBool( |
| 2765 internals_web_contents->GetRenderViewHost(), find_browser_logs, |
| 2766 &browser_logs_found)); |
| 2767 EXPECT_TRUE(browser_logs_found); |
| 2768 } |
| 2769 |
2737 } // namespace password_manager | 2770 } // namespace password_manager |
OLD | NEW |