| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/string16.h" | 5 #include "base/strings/string16.h" |
| 6 #include "base/strings/string_util.h" | 6 #include "base/strings/string_util.h" |
| 7 #include "base/strings/stringprintf.h" | 7 #include "base/strings/stringprintf.h" |
| 8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
| 9 #include "components/autofill/content/renderer/password_form_conversion_utils.h" | 9 #include "components/autofill/content/renderer/password_form_conversion_utils.h" |
| 10 #include "components/autofill/core/common/password_form.h" | 10 #include "components/autofill/core/common/password_form.h" |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 | 98 |
| 99 private: | 99 private: |
| 100 std::string html_; | 100 std::string html_; |
| 101 | 101 |
| 102 DISALLOW_COPY_AND_ASSIGN(PasswordFormBuilder); | 102 DISALLOW_COPY_AND_ASSIGN(PasswordFormBuilder); |
| 103 }; | 103 }; |
| 104 | 104 |
| 105 class PasswordFormConversionUtilsTest : public content::RenderViewTest { | 105 class PasswordFormConversionUtilsTest : public content::RenderViewTest { |
| 106 public: | 106 public: |
| 107 PasswordFormConversionUtilsTest() : content::RenderViewTest() {} | 107 PasswordFormConversionUtilsTest() : content::RenderViewTest() {} |
| 108 virtual ~PasswordFormConversionUtilsTest() {} | 108 ~PasswordFormConversionUtilsTest() override {} |
| 109 | 109 |
| 110 protected: | 110 protected: |
| 111 // Loads the given |html|, retrieves the sole WebFormElement from it, and then | 111 // Loads the given |html|, retrieves the sole WebFormElement from it, and then |
| 112 // calls CreatePasswordForm() to convert it into a |password_form|. Note that | 112 // calls CreatePasswordForm() to convert it into a |password_form|. Note that |
| 113 // ASSERT() can only be used in void functions, this is why |password_form| is | 113 // ASSERT() can only be used in void functions, this is why |password_form| is |
| 114 // passed in as a pointer to a scoped_ptr. | 114 // passed in as a pointer to a scoped_ptr. |
| 115 void LoadHTMLAndConvertForm(const std::string& html, | 115 void LoadHTMLAndConvertForm(const std::string& html, |
| 116 scoped_ptr<PasswordForm>* password_form) { | 116 scoped_ptr<PasswordForm>* password_form) { |
| 117 LoadHTML(html.c_str()); | 117 LoadHTML(html.c_str()); |
| 118 | 118 |
| (...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 583 builder.AddPasswordField("password4", "alpha", NULL); | 583 builder.AddPasswordField("password4", "alpha", NULL); |
| 584 builder.AddSubmitButton("submit", true); | 584 builder.AddSubmitButton("submit", true); |
| 585 std::string html = builder.ProduceHTML(); | 585 std::string html = builder.ProduceHTML(); |
| 586 | 586 |
| 587 scoped_ptr<PasswordForm> password_form; | 587 scoped_ptr<PasswordForm> password_form; |
| 588 ASSERT_NO_FATAL_FAILURE(LoadHTMLAndConvertForm(html, &password_form)); | 588 ASSERT_NO_FATAL_FAILURE(LoadHTMLAndConvertForm(html, &password_form)); |
| 589 EXPECT_FALSE(password_form); | 589 EXPECT_FALSE(password_form); |
| 590 } | 590 } |
| 591 | 591 |
| 592 } // namespace autofill | 592 } // namespace autofill |
| OLD | NEW |