| 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 1756 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1767 "document.getElementById('username_field').value = 'username';" | 1767 "document.getElementById('username_field').value = 'username';" |
| 1768 "document.getElementById('password_field').value = 'mypass';" | 1768 "document.getElementById('password_field').value = 'mypass';" |
| 1769 "document.getElementById('confirm_field').value = 'mypass';" | 1769 "document.getElementById('confirm_field').value = 'mypass';" |
| 1770 "document.getElementById('security_answer').value = 'hometown';" | 1770 "document.getElementById('security_answer').value = 'hometown';" |
| 1771 "document.getElementById('SSN').value = '1234';" | 1771 "document.getElementById('SSN').value = '1234';" |
| 1772 "document.getElementById('testform').submit();"; | 1772 "document.getElementById('testform').submit();"; |
| 1773 ASSERT_TRUE(content::ExecuteScript(RenderViewHost(), fill_and_submit)); | 1773 ASSERT_TRUE(content::ExecuteScript(RenderViewHost(), fill_and_submit)); |
| 1774 observer.Wait(); | 1774 observer.Wait(); |
| 1775 EXPECT_TRUE(prompt_observer->IsShowingPrompt()); | 1775 EXPECT_TRUE(prompt_observer->IsShowingPrompt()); |
| 1776 } | 1776 } |
| 1777 |
| 1778 IN_PROC_BROWSER_TEST_F(PasswordManagerBrowserTest, |
| 1779 SaveWhenIFrameDestroyedOnFormSubmit) { |
| 1780 NavigateToFile("/password/frame_detached_on_submit.html"); |
| 1781 |
| 1782 // Need to pay attention for a message that XHR has finished since there |
| 1783 // is no navigation to wait for. |
| 1784 content::DOMMessageQueue message_queue; |
| 1785 |
| 1786 scoped_ptr<PromptObserver> prompt_observer( |
| 1787 PromptObserver::Create(WebContents())); |
| 1788 std::string fill_and_submit = |
| 1789 "var iframe = document.getElementById('login_iframe');" |
| 1790 "var frame_doc = iframe.contentDocument;" |
| 1791 "frame_doc.getElementById('username_field').value = 'temp';" |
| 1792 "frame_doc.getElementById('password_field').value = 'random';" |
| 1793 "frame_doc.getElementById('submit_button').click();"; |
| 1794 |
| 1795 ASSERT_TRUE(content::ExecuteScript(RenderViewHost(), fill_and_submit)); |
| 1796 std::string message; |
| 1797 while (message_queue.WaitForMessage(&message)) { |
| 1798 if (message == "\"SUBMISSION_FINISHED\"") |
| 1799 break; |
| 1800 } |
| 1801 |
| 1802 EXPECT_TRUE(prompt_observer->IsShowingPrompt()); |
| 1803 } |
| OLD | NEW |