| 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 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 AutofillMsg_FillPasswordForm msg(0, fill_data); | 179 AutofillMsg_FillPasswordForm msg(0, fill_data); |
| 180 static_cast<content::RenderViewObserver*>(password_autofill_agent_) | 180 static_cast<content::RenderViewObserver*>(password_autofill_agent_) |
| 181 ->OnMessageReceived(msg); | 181 ->OnMessageReceived(msg); |
| 182 } | 182 } |
| 183 | 183 |
| 184 void SendVisiblePasswordForms() { | 184 void SendVisiblePasswordForms() { |
| 185 static_cast<content::RenderViewObserver*>(password_autofill_agent_) | 185 static_cast<content::RenderViewObserver*>(password_autofill_agent_) |
| 186 ->DidFinishLoad(GetMainFrame()); | 186 ->DidFinishLoad(GetMainFrame()); |
| 187 } | 187 } |
| 188 | 188 |
| 189 virtual void SetUp() { | 189 void SetUp() override { |
| 190 ChromeRenderViewTest::SetUp(); | 190 ChromeRenderViewTest::SetUp(); |
| 191 | 191 |
| 192 // Add a preferred login and an additional login to the FillData. | 192 // Add a preferred login and an additional login to the FillData. |
| 193 username1_ = ASCIIToUTF16(kAliceUsername); | 193 username1_ = ASCIIToUTF16(kAliceUsername); |
| 194 password1_ = ASCIIToUTF16(kAlicePassword); | 194 password1_ = ASCIIToUTF16(kAlicePassword); |
| 195 username2_ = ASCIIToUTF16(kBobUsername); | 195 username2_ = ASCIIToUTF16(kBobUsername); |
| 196 password2_ = ASCIIToUTF16(kBobPassword); | 196 password2_ = ASCIIToUTF16(kBobPassword); |
| 197 username3_ = ASCIIToUTF16(kCarolUsername); | 197 username3_ = ASCIIToUTF16(kCarolUsername); |
| 198 password3_ = ASCIIToUTF16(kCarolPassword); | 198 password3_ = ASCIIToUTF16(kCarolPassword); |
| 199 alternate_username3_ = ASCIIToUTF16(kCarolAlternateUsername); | 199 alternate_username3_ = ASCIIToUTF16(kCarolAlternateUsername); |
| (...skipping 26 matching lines...) Expand all Loading... |
| 226 // it matches the form action, otherwise we won't autocomplete. | 226 // it matches the form action, otherwise we won't autocomplete. |
| 227 UpdateOriginForHTML(kFormHTML); | 227 UpdateOriginForHTML(kFormHTML); |
| 228 fill_data_.basic_data.action = GURL("http://www.bidule.com"); | 228 fill_data_.basic_data.action = GURL("http://www.bidule.com"); |
| 229 | 229 |
| 230 LoadHTML(kFormHTML); | 230 LoadHTML(kFormHTML); |
| 231 | 231 |
| 232 // Now retrieve the input elements so the test can access them. | 232 // Now retrieve the input elements so the test can access them. |
| 233 UpdateUsernameAndPasswordElements(); | 233 UpdateUsernameAndPasswordElements(); |
| 234 } | 234 } |
| 235 | 235 |
| 236 virtual void TearDown() { | 236 void TearDown() override { |
| 237 username_element_.reset(); | 237 username_element_.reset(); |
| 238 password_element_.reset(); | 238 password_element_.reset(); |
| 239 ChromeRenderViewTest::TearDown(); | 239 ChromeRenderViewTest::TearDown(); |
| 240 } | 240 } |
| 241 | 241 |
| 242 void UpdateOriginForHTML(const std::string& html) { | 242 void UpdateOriginForHTML(const std::string& html) { |
| 243 std::string origin = "data:text/html;charset=utf-8," + html; | 243 std::string origin = "data:text/html;charset=utf-8," + html; |
| 244 fill_data_.basic_data.origin = GURL(origin); | 244 fill_data_.basic_data.origin = GURL(origin); |
| 245 } | 245 } |
| 246 | 246 |
| (...skipping 1379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1626 password_element_, | 1626 password_element_, |
| 1627 /*is_user_input=*/true); | 1627 /*is_user_input=*/true); |
| 1628 | 1628 |
| 1629 // Simulate the user typing a stored username. | 1629 // Simulate the user typing a stored username. |
| 1630 SimulateUsernameChange(kAliceUsername, true); | 1630 SimulateUsernameChange(kAliceUsername, true); |
| 1631 // The autofileld password should replace the typed one. | 1631 // The autofileld password should replace the typed one. |
| 1632 CheckTextFieldsDOMState(kAliceUsername, true, kAlicePassword, true); | 1632 CheckTextFieldsDOMState(kAliceUsername, true, kAlicePassword, true); |
| 1633 } | 1633 } |
| 1634 | 1634 |
| 1635 } // namespace autofill | 1635 } // namespace autofill |
| OLD | NEW |