Index: components/autofill/core/common/password_form_fill_data_unittest.cc |
diff --git a/components/autofill/core/common/password_form_fill_data_unittest.cc b/components/autofill/core/common/password_form_fill_data_unittest.cc |
index 3a8954d3bb9e728223396a2438df1957da23a06c..fd08e4f691ee84f62e4ca50bfbd4c401c05de436 100644 |
--- a/components/autofill/core/common/password_form_fill_data_unittest.cc |
+++ b/components/autofill/core/common/password_form_fill_data_unittest.cc |
@@ -4,9 +4,11 @@ |
#include "components/autofill/core/common/password_form_fill_data.h" |
+#include <map> |
#include <memory> |
#include <utility> |
+#include "base/strings/string16.h" |
#include "base/strings/utf_string_conversions.h" |
#include "components/autofill/core/common/password_form.h" |
#include "testing/gmock/include/gmock/gmock.h" |
@@ -45,7 +47,7 @@ TEST(PasswordFormFillDataTest, TestSinglePreferredMatch) { |
preferred_match.preferred = true; |
preferred_match.scheme = PasswordForm::SCHEME_HTML; |
- PasswordFormMap matches; |
+ std::map<base::string16, const PasswordForm*> matches; |
PasswordFormFillData result; |
InitPasswordFormFillData(form_on_page, |
@@ -109,8 +111,7 @@ TEST(PasswordFormFillDataTest, TestPublicSuffixDomainMatching) { |
// Create a match that matches exactly, so |is_public_suffix_match| has a |
// default value false. |
- std::unique_ptr<PasswordForm> scoped_exact_match(new PasswordForm); |
- PasswordForm& exact_match = *scoped_exact_match; |
+ PasswordForm exact_match; |
exact_match.origin = GURL("https://foo.com/"); |
exact_match.action = GURL("https://foo.com/login"); |
exact_match.username_element = ASCIIToUTF16("username"); |
@@ -124,8 +125,7 @@ TEST(PasswordFormFillDataTest, TestPublicSuffixDomainMatching) { |
// Create a match that was matched using public suffix, so |
// |is_public_suffix_match| == true. |
- std::unique_ptr<PasswordForm> scoped_public_suffix_match(new PasswordForm); |
- PasswordForm& public_suffix_match = *scoped_public_suffix_match; |
+ PasswordForm public_suffix_match; |
public_suffix_match.origin = GURL("https://foo.com/"); |
public_suffix_match.action = GURL("https://foo.com/login"); |
public_suffix_match.username_element = ASCIIToUTF16("username"); |
@@ -139,11 +139,10 @@ TEST(PasswordFormFillDataTest, TestPublicSuffixDomainMatching) { |
public_suffix_match.scheme = PasswordForm::SCHEME_HTML; |
// Add one exact match and one public suffix match. |
- PasswordFormMap matches; |
- matches.insert(std::make_pair(exact_match.username_value, |
- std::move(scoped_exact_match))); |
- matches.insert(std::make_pair(public_suffix_match.username_value, |
- std::move(scoped_public_suffix_match))); |
+ std::map<base::string16, const PasswordForm*> matches; |
+ matches.insert(std::make_pair(exact_match.username_value, &exact_match)); |
+ matches.insert( |
+ std::make_pair(public_suffix_match.username_value, &public_suffix_match)); |
PasswordFormFillData result; |
InitPasswordFormFillData(form_on_page, |
@@ -197,8 +196,7 @@ TEST(PasswordFormFillDataTest, TestAffiliationMatch) { |
// Create a match that matches exactly, so |is_affiliation_based_match| has a |
// default value false. |
- std::unique_ptr<PasswordForm> scoped_exact_match(new PasswordForm); |
- PasswordForm& exact_match = *scoped_exact_match; |
+ PasswordForm exact_match; |
exact_match.origin = GURL("https://foo.com/"); |
exact_match.action = GURL("https://foo.com/login"); |
exact_match.username_element = ASCIIToUTF16("username"); |
@@ -212,8 +210,7 @@ TEST(PasswordFormFillDataTest, TestAffiliationMatch) { |
// Create a match that was matched using public suffix, so |
// |is_public_suffix_match| == true. |
- std::unique_ptr<PasswordForm> scoped_affiliated_match(new PasswordForm); |
- PasswordForm& affiliated_match = *scoped_affiliated_match; |
+ PasswordForm affiliated_match; |
affiliated_match.origin = GURL("android://hash@foo1.com/"); |
affiliated_match.username_value = ASCIIToUTF16("test2@gmail.com"); |
affiliated_match.password_value = ASCIIToUTF16("test"); |
@@ -223,11 +220,10 @@ TEST(PasswordFormFillDataTest, TestAffiliationMatch) { |
affiliated_match.scheme = PasswordForm::SCHEME_HTML; |
// Add one exact match and one affiliation based match. |
- PasswordFormMap matches; |
- matches.insert(std::make_pair(exact_match.username_value, |
- std::move(scoped_exact_match))); |
- matches.insert(std::make_pair(affiliated_match.username_value, |
- std::move(scoped_affiliated_match))); |
+ std::map<base::string16, const PasswordForm*> matches; |
+ matches.insert(std::make_pair(exact_match.username_value, &exact_match)); |
+ matches.insert( |
+ std::make_pair(affiliated_match.username_value, &affiliated_match)); |
PasswordFormFillData result; |
InitPasswordFormFillData(form_on_page, matches, &preferred_match, false, |