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 1424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1435 } | 1435 } |
1436 | 1436 |
1437 // Test that the agent sends an IPC call to get the current activity state of | 1437 // Test that the agent sends an IPC call to get the current activity state of |
1438 // password saving logging soon after construction. | 1438 // password saving logging soon after construction. |
1439 TEST_F(PasswordAutofillAgentTest, SendsLoggingStateUpdatePingOnConstruction) { | 1439 TEST_F(PasswordAutofillAgentTest, SendsLoggingStateUpdatePingOnConstruction) { |
1440 const IPC::Message* message = render_thread_->sink().GetFirstMessageMatching( | 1440 const IPC::Message* message = render_thread_->sink().GetFirstMessageMatching( |
1441 AutofillHostMsg_PasswordAutofillAgentConstructed::ID); | 1441 AutofillHostMsg_PasswordAutofillAgentConstructed::ID); |
1442 EXPECT_TRUE(message); | 1442 EXPECT_TRUE(message); |
1443 } | 1443 } |
1444 | 1444 |
| 1445 // TODO(gcasto): Re-enabled these tests after crbug.com/423464 has been fixed. |
| 1446 #if !defined(OS_ANDROID) |
| 1447 |
1445 // Tests that one user click on a username field is sufficient to bring up a | 1448 // Tests that one user click on a username field is sufficient to bring up a |
1446 // credential suggestion popup, and the user can autocomplete the password by | 1449 // credential suggestion popup, and the user can autocomplete the password by |
1447 // selecting the credential from the popup. | 1450 // selecting the credential from the popup. |
1448 TEST_F(PasswordAutofillAgentTest, ClickAndSelect) { | 1451 TEST_F(PasswordAutofillAgentTest, ClickAndSelect) { |
1449 // SimulateElementClick() is called so that a user gesture is actually made | 1452 // SimulateElementClick() is called so that a user gesture is actually made |
1450 // and the password can be filled. However, SimulateElementClick() does not | 1453 // and the password can be filled. However, SimulateElementClick() does not |
1451 // actually lead to the AutofillAgent's InputElementClicked() method being | 1454 // actually lead to the AutofillAgent's InputElementClicked() method being |
1452 // called, so SimulateSuggestionChoice has to manually call | 1455 // called, so SimulateSuggestionChoice has to manually call |
1453 // InputElementClicked(). | 1456 // InputElementClicked(). |
1454 ClearUsernameAndPasswordFields(); | 1457 ClearUsernameAndPasswordFields(); |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1496 // clicking on the username element. While the typing of the first letter will | 1499 // clicking on the username element. While the typing of the first letter will |
1497 // inline autocomplete, clicking on the element should still produce a full | 1500 // inline autocomplete, clicking on the element should still produce a full |
1498 // suggestion list. | 1501 // suggestion list. |
1499 SimulateUsernameChange("a", true); | 1502 SimulateUsernameChange("a", true); |
1500 render_thread_->sink().ClearMessages(); | 1503 render_thread_->sink().ClearMessages(); |
1501 static_cast<PageClickListener*>(autofill_agent_) | 1504 static_cast<PageClickListener*>(autofill_agent_) |
1502 ->FormControlElementClicked(username_element_, true); | 1505 ->FormControlElementClicked(username_element_, true); |
1503 ExpectAllCredentials(); | 1506 ExpectAllCredentials(); |
1504 } | 1507 } |
1505 | 1508 |
| 1509 #endif // !defined(OS_ANDROID) |
| 1510 |
1506 // The user types in a password, but then just before sending the form off, a | 1511 // The user types in a password, but then just before sending the form off, a |
1507 // script clears that password. This test checks that PasswordAutofillAgent can | 1512 // script clears that password. This test checks that PasswordAutofillAgent can |
1508 // still remember the password typed by the user. | 1513 // still remember the password typed by the user. |
1509 TEST_F(PasswordAutofillAgentTest, | 1514 TEST_F(PasswordAutofillAgentTest, |
1510 RememberLastNonEmptyPasswordOnSubmit_ScriptCleared) { | 1515 RememberLastNonEmptyPasswordOnSubmit_ScriptCleared) { |
1511 SimulateInputChangeForElement( | 1516 SimulateInputChangeForElement( |
1512 "temp", true, GetMainFrame(), username_element_, true); | 1517 "temp", true, GetMainFrame(), username_element_, true); |
1513 SimulateInputChangeForElement( | 1518 SimulateInputChangeForElement( |
1514 "random", true, GetMainFrame(), password_element_, true); | 1519 "random", true, GetMainFrame(), password_element_, true); |
1515 | 1520 |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1626 password_element_, | 1631 password_element_, |
1627 /*is_user_input=*/true); | 1632 /*is_user_input=*/true); |
1628 | 1633 |
1629 // Simulate the user typing a stored username. | 1634 // Simulate the user typing a stored username. |
1630 SimulateUsernameChange(kAliceUsername, true); | 1635 SimulateUsernameChange(kAliceUsername, true); |
1631 // The autofileld password should replace the typed one. | 1636 // The autofileld password should replace the typed one. |
1632 CheckTextFieldsDOMState(kAliceUsername, true, kAlicePassword, true); | 1637 CheckTextFieldsDOMState(kAliceUsername, true, kAlicePassword, true); |
1633 } | 1638 } |
1634 | 1639 |
1635 } // namespace autofill | 1640 } // namespace autofill |
OLD | NEW |