Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "base/strings/string_util.h" | 5 #include "base/strings/string_util.h" |
| 6 #include "base/strings/utf_string_conversions.h" | 6 #include "base/strings/utf_string_conversions.h" |
| 7 #include "chrome/test/base/chrome_render_view_test.h" | 7 #include "chrome/test/base/chrome_render_view_test.h" |
| 8 #include "components/autofill/content/common/autofill_messages.h" | 8 #include "components/autofill/content/common/autofill_messages.h" |
| 9 #include "components/autofill/content/renderer/autofill_agent.h" | 9 #include "components/autofill/content/renderer/autofill_agent.h" |
| 10 #include "components/autofill/content/renderer/form_autofill_util.h" | 10 #include "components/autofill/content/renderer/form_autofill_util.h" |
| (...skipping 800 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 811 EXPECT_TRUE(render_thread_->sink().GetFirstMessageMatching( | 811 EXPECT_TRUE(render_thread_->sink().GetFirstMessageMatching( |
| 812 AutofillHostMsg_PasswordFormsRendered::ID)); | 812 AutofillHostMsg_PasswordFormsRendered::ID)); |
| 813 | 813 |
| 814 render_thread_->sink().ClearMessages(); | 814 render_thread_->sink().ClearMessages(); |
| 815 LoadHTML(kWebpageWithDynamicContent); | 815 LoadHTML(kWebpageWithDynamicContent); |
| 816 EXPECT_TRUE(render_thread_->sink().GetFirstMessageMatching( | 816 EXPECT_TRUE(render_thread_->sink().GetFirstMessageMatching( |
| 817 AutofillHostMsg_PasswordFormsRendered::ID)); | 817 AutofillHostMsg_PasswordFormsRendered::ID)); |
| 818 } | 818 } |
| 819 | 819 |
| 820 // Tests that a password form in an iframe will not be filled in until a user | 820 // Tests that a password form in an iframe will not be filled in until a user |
| 821 // interaction with the form. | 821 // interaction with the form. |
|
Garrett Casto
2015/06/01 22:48:51
So I would just remove this test. We test this sam
xunlu
2015/06/01 23:41:38
Done.
| |
| 822 TEST_F(PasswordAutofillAgentTest, IframeNoFillTest) { | 822 TEST_F(PasswordAutofillAgentTest, IframeNoFillTest) { |
| 823 const char kIframeName[] = "iframe"; | 823 const char kIframeName[] = "iframe"; |
| 824 const char kWebpageWithIframeStart[] = | 824 const char kWebpageWithIframeStart[] = |
| 825 "<html>" | 825 "<html>" |
| 826 " <head>" | 826 " <head>" |
| 827 " <meta charset='utf-8' />" | 827 " <meta charset='utf-8' />" |
| 828 " <title>Title</title>" | 828 " <title>Title</title>" |
| 829 " </head>" | 829 " </head>" |
| 830 " <body>" | 830 " <body>" |
| 831 " <iframe name='iframe' src=\""; | 831 " <iframe name='iframe' src=\""; |
| (...skipping 27 matching lines...) Expand all Loading... | |
| 859 WebElement username_element = document.getElementById(kUsernameName); | 859 WebElement username_element = document.getElementById(kUsernameName); |
| 860 WebElement password_element = document.getElementById(kPasswordName); | 860 WebElement password_element = document.getElementById(kPasswordName); |
| 861 ASSERT_FALSE(username_element.isNull()); | 861 ASSERT_FALSE(username_element.isNull()); |
| 862 ASSERT_FALSE(password_element.isNull()); | 862 ASSERT_FALSE(password_element.isNull()); |
| 863 | 863 |
| 864 WebInputElement username_input = username_element.to<WebInputElement>(); | 864 WebInputElement username_input = username_element.to<WebInputElement>(); |
| 865 WebInputElement password_input = password_element.to<WebInputElement>(); | 865 WebInputElement password_input = password_element.to<WebInputElement>(); |
| 866 ASSERT_FALSE(username_element.isNull()); | 866 ASSERT_FALSE(username_element.isNull()); |
| 867 | 867 |
| 868 CheckTextFieldsStateForElements( | 868 CheckTextFieldsStateForElements( |
| 869 username_input, "", false, password_input, "", false, false); | 869 username_input, kAliceUsername, true, password_input, "", true, false); |
| 870 | 870 |
| 871 // Simulate the user typing in the username in the iframe which should cause | 871 // Simulate the user typing in the username in the iframe which should cause |
| 872 // an autofill. | 872 // an autofill. |
| 873 content::RenderFrame::FromWebFrame(iframe) | 873 content::RenderFrame::FromWebFrame(iframe) |
| 874 ->OnMessageReceived(AutofillMsg_FirstUserGestureObservedInTab(0)); | 874 ->OnMessageReceived(AutofillMsg_FirstUserGestureObservedInTab(0)); |
| 875 SimulateUserInputChangeForElement(&username_input, kAliceUsername); | 875 SimulateUserInputChangeForElement(&username_input, kAliceUsername); |
| 876 | 876 |
| 877 CheckTextFieldsStateForElements(username_input, | 877 CheckTextFieldsStateForElements(username_input, |
| 878 kAliceUsername, | 878 kAliceUsername, |
| 879 true, | 879 true, |
| (...skipping 973 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1853 ->WillSendSubmitEvent(username_element_.form()); | 1853 ->WillSendSubmitEvent(username_element_.form()); |
| 1854 static_cast<content::RenderFrameObserver*>(password_autofill_agent_) | 1854 static_cast<content::RenderFrameObserver*>(password_autofill_agent_) |
| 1855 ->WillSubmitForm(username_element_.form()); | 1855 ->WillSubmitForm(username_element_.form()); |
| 1856 | 1856 |
| 1857 // Observe that the PasswordAutofillAgent identifies the first field as | 1857 // Observe that the PasswordAutofillAgent identifies the first field as |
| 1858 // username. | 1858 // username. |
| 1859 ExpectFormSubmittedWithUsernameAndPasswords("temp", "random", ""); | 1859 ExpectFormSubmittedWithUsernameAndPasswords("temp", "random", ""); |
| 1860 } | 1860 } |
| 1861 | 1861 |
| 1862 } // namespace autofill | 1862 } // namespace autofill |
| OLD | NEW |