| 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 392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 403 | 403 |
| 404 // Checks the message sent to PasswordAutofillManager to build the suggestion | 404 // Checks the message sent to PasswordAutofillManager to build the suggestion |
| 405 // list. |username| is the expected username field value, and |show_all| is | 405 // list. |username| is the expected username field value, and |show_all| is |
| 406 // the expected flag for the PasswordAutofillManager, whether to show all | 406 // the expected flag for the PasswordAutofillManager, whether to show all |
| 407 // suggestions, or only those starting with |username|. | 407 // suggestions, or only those starting with |username|. |
| 408 void CheckSuggestions(const std::string& username, bool show_all) { | 408 void CheckSuggestions(const std::string& username, bool show_all) { |
| 409 const IPC::Message* message = | 409 const IPC::Message* message = |
| 410 render_thread_->sink().GetFirstMessageMatching( | 410 render_thread_->sink().GetFirstMessageMatching( |
| 411 AutofillHostMsg_ShowPasswordSuggestions::ID); | 411 AutofillHostMsg_ShowPasswordSuggestions::ID); |
| 412 EXPECT_TRUE(message); | 412 EXPECT_TRUE(message); |
| 413 Tuple5<int, base::i18n::TextDirection, base::string16, bool, gfx::RectF> | 413 Tuple5<int, base::i18n::TextDirection, base::string16, int, gfx::RectF> |
| 414 args; | 414 args; |
| 415 AutofillHostMsg_ShowPasswordSuggestions::Read(message, &args); | 415 AutofillHostMsg_ShowPasswordSuggestions::Read(message, &args); |
| 416 EXPECT_EQ(kPasswordFillFormDataId, args.a); | 416 EXPECT_EQ(kPasswordFillFormDataId, args.a); |
| 417 EXPECT_EQ(ASCIIToUTF16(username), args.c); | 417 EXPECT_EQ(ASCIIToUTF16(username), args.c); |
| 418 EXPECT_EQ(show_all, args.d); | 418 int options = args.d; |
| 419 EXPECT_EQ(show_all, options & ShowPasswordSuggestionsOptions::SHOW_ALL); |
| 419 | 420 |
| 420 render_thread_->sink().ClearMessages(); | 421 render_thread_->sink().ClearMessages(); |
| 421 } | 422 } |
| 422 | 423 |
| 423 void ExpectFormSubmittedWithUsernameAndPasswords( | 424 void ExpectFormSubmittedWithUsernameAndPasswords( |
| 424 const std::string& username_value, | 425 const std::string& username_value, |
| 425 const std::string& password_value, | 426 const std::string& password_value, |
| 426 const std::string& new_password_value) { | 427 const std::string& new_password_value) { |
| 427 const IPC::Message* message = | 428 const IPC::Message* message = |
| 428 render_thread_->sink().GetFirstMessageMatching( | 429 render_thread_->sink().GetFirstMessageMatching( |
| (...skipping 1108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1537 password_element_, | 1538 password_element_, |
| 1538 /*is_user_input=*/true); | 1539 /*is_user_input=*/true); |
| 1539 | 1540 |
| 1540 // Simulate the user typing a stored username. | 1541 // Simulate the user typing a stored username. |
| 1541 SimulateUsernameChange(kAliceUsername, true); | 1542 SimulateUsernameChange(kAliceUsername, true); |
| 1542 // The autofileld password should replace the typed one. | 1543 // The autofileld password should replace the typed one. |
| 1543 CheckTextFieldsDOMState(kAliceUsername, true, kAlicePassword, true); | 1544 CheckTextFieldsDOMState(kAliceUsername, true, kAlicePassword, true); |
| 1544 } | 1545 } |
| 1545 | 1546 |
| 1546 } // namespace autofill | 1547 } // namespace autofill |
| OLD | NEW |