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/renderer/autofill/password_generation_test_utils.h" | 7 #include "chrome/renderer/autofill/password_generation_test_utils.h" |
| 8 #include "chrome/test/base/chrome_render_view_test.h" | 8 #include "chrome/test/base/chrome_render_view_test.h" |
| 9 #include "components/autofill/content/common/autofill_messages.h" | 9 #include "components/autofill/content/common/autofill_messages.h" |
| 10 #include "components/autofill/content/renderer/autofill_agent.h" | 10 #include "components/autofill/content/renderer/autofill_agent.h" |
| (...skipping 535 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 546 WebElement element = | 546 WebElement element = |
| 547 document.getElementById(WebString::fromUTF8(kUsernameName)); | 547 document.getElementById(WebString::fromUTF8(kUsernameName)); |
| 548 ASSERT_FALSE(element.isNull()); | 548 ASSERT_FALSE(element.isNull()); |
| 549 username_element_ = element.to<blink::WebInputElement>(); | 549 username_element_ = element.to<blink::WebInputElement>(); |
| 550 element = document.getElementById(WebString::fromUTF8(kPasswordName)); | 550 element = document.getElementById(WebString::fromUTF8(kPasswordName)); |
| 551 ASSERT_FALSE(element.isNull()); | 551 ASSERT_FALSE(element.isNull()); |
| 552 password_element_ = element.to<blink::WebInputElement>(); | 552 password_element_ = element.to<blink::WebInputElement>(); |
| 553 | 553 |
| 554 // Set the expected form origin and action URLs. | 554 // Set the expected form origin and action URLs. |
| 555 UpdateOriginForHTML(kEmptyActionFormHTML); | 555 UpdateOriginForHTML(kEmptyActionFormHTML); |
| 556 fill_data_.action = fill_data_.origin; | 556 fill_data_.action = GURL(""); |
|
vabr (Chromium)
2015/11/06 11:24:14
Does GURL() and GURL("") result in the same object
ramya.v
2015/11/06 13:45:14
Done.
| |
| 557 | 557 |
| 558 // Simulate the browser sending back the login info, it triggers the | 558 // Simulate the browser sending back the login info, it triggers the |
| 559 // autocomplete. | 559 // autocomplete. |
| 560 SimulateOnFillPasswordForm(fill_data_); | 560 SimulateOnFillPasswordForm(fill_data_); |
| 561 | 561 |
| 562 // The username and password should have been autocompleted. | 562 // The username and password should have been autocompleted. |
| 563 CheckTextFieldsState(kAliceUsername, true, kAlicePassword, true); | 563 CheckTextFieldsState(kAliceUsername, true, kAlicePassword, true); |
| 564 } | 564 } |
| 565 | 565 |
| 566 // Tests that if a password is marked as readonly, neither field is autofilled | 566 // Tests that if a password is marked as readonly, neither field is autofilled |
| (...skipping 826 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1393 // Observe that the PasswordAutofillAgent respects the user having cleared the | 1393 // Observe that the PasswordAutofillAgent respects the user having cleared the |
| 1394 // password. | 1394 // password. |
| 1395 ExpectFormSubmittedWithUsernameAndPasswords("", "", ""); | 1395 ExpectFormSubmittedWithUsernameAndPasswords("", "", ""); |
| 1396 } | 1396 } |
| 1397 | 1397 |
| 1398 // Similar to RememberLastNonEmptyPasswordOnSubmit_ScriptCleared, but uses the | 1398 // Similar to RememberLastNonEmptyPasswordOnSubmit_ScriptCleared, but uses the |
| 1399 // new password instead of the current password. | 1399 // new password instead of the current password. |
| 1400 TEST_F(PasswordAutofillAgentTest, | 1400 TEST_F(PasswordAutofillAgentTest, |
| 1401 RememberLastNonEmptyUsernameAndPasswordOnSubmit_New) { | 1401 RememberLastNonEmptyUsernameAndPasswordOnSubmit_New) { |
| 1402 const char kNewPasswordFormHTML[] = | 1402 const char kNewPasswordFormHTML[] = |
| 1403 "<FORM name='LoginTestForm'>" | 1403 "<FORM name='LoginTestForm' action='http://www.bidule.com'>" |
|
vabr (Chromium)
2015/11/06 11:24:14
What exactly went wrong with this test when the ac
ramya.v
2015/11/06 13:45:14
In PasswordAutofillAgent::WillSubmitForm
submitted
vabr (Chromium)
2015/11/06 14:08:54
Acknowledged.
| |
| 1404 " <INPUT type='text' id='username' autocomplete='username'/>" | 1404 " <INPUT type='text' id='username' autocomplete='username'/>" |
| 1405 " <INPUT type='password' id='password' autocomplete='new-password'/>" | 1405 " <INPUT type='password' id='password' autocomplete='new-password'/>" |
| 1406 " <INPUT type='submit' value='Login'/>" | 1406 " <INPUT type='submit' value='Login'/>" |
| 1407 "</FORM>"; | 1407 "</FORM>"; |
| 1408 LoadHTML(kNewPasswordFormHTML); | 1408 LoadHTML(kNewPasswordFormHTML); |
| 1409 UpdateUsernameAndPasswordElements(); | 1409 UpdateUsernameAndPasswordElements(); |
| 1410 | 1410 |
| 1411 SimulateUsernameChange("temp"); | 1411 SimulateUsernameChange("temp"); |
| 1412 SimulatePasswordChange("random"); | 1412 SimulatePasswordChange("random"); |
| 1413 | 1413 |
| (...skipping 875 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2289 UpdateOriginForHTML(kTwoNoUsernameFormsHTML); | 2289 UpdateOriginForHTML(kTwoNoUsernameFormsHTML); |
| 2290 SimulateOnFillPasswordForm(fill_data_); | 2290 SimulateOnFillPasswordForm(fill_data_); |
| 2291 | 2291 |
| 2292 SimulateElementClick("password1"); | 2292 SimulateElementClick("password1"); |
| 2293 CheckSuggestions(std::string(), false); | 2293 CheckSuggestions(std::string(), false); |
| 2294 SimulateElementClick("password2"); | 2294 SimulateElementClick("password2"); |
| 2295 CheckSuggestions(std::string(), false); | 2295 CheckSuggestions(std::string(), false); |
| 2296 } | 2296 } |
| 2297 | 2297 |
| 2298 } // namespace autofill | 2298 } // namespace autofill |
| OLD | NEW |